From: rich Date: Thu, 16 Oct 2003 11:03:51 +0000 (+0000) Subject: Fixed a silly crashing bug in the FFI code. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=c6a26bacdd51fbe32048e4ac15545dd58039cf32;p=perl4caml.git Fixed a silly crashing bug in the FFI code. --- diff --git a/examples/google.ml b/examples/google.ml index 2e8ca40..d21d27f 100644 --- a/examples/google.ml +++ b/examples/google.ml @@ -1,7 +1,7 @@ (* Example program which uses Net::Google to query Google. * You will need to have a Google API key in ~/.googlekey for this to work. * Copyright (C) 2003 Merjis Ltd. - * $Id: google.ml,v 1.2 2003-10-15 16:51:12 rich Exp $ + * $Id: google.ml,v 1.3 2003-10-16 11:03:52 rich Exp $ *) open Printf @@ -31,4 +31,7 @@ let () = ) search#results; (* Destroy the Perl interpreter. *) - Perl.destroy (Perl.current_interpreter ()) + Perl.destroy (Perl.current_interpreter ()); + + (* Perform a full collection - good way to find GC/allocation bugs. *) + Gc.full_major () diff --git a/examples/loadpage.ml b/examples/loadpage.ml index 4007f8d..dfb4afd 100644 --- a/examples/loadpage.ml +++ b/examples/loadpage.ml @@ -1,7 +1,7 @@ (* Example program which uses LWP::UserAgent and HTML::TreeBuilder to * download an HTTP page and parse it. * Copyright (C) 2003 Merjis Ltd. - * $Id: loadpage.ml,v 1.3 2003-10-15 16:51:12 rich Exp $ + * $Id: loadpage.ml,v 1.4 2003-10-16 11:03:52 rich Exp $ *) open Printf @@ -57,4 +57,7 @@ let () = print tree; (* Destroy the Perl interpreter. *) - Perl.destroy (Perl.current_interpreter ()) + Perl.destroy (Perl.current_interpreter ()); + + (* Perform a full collection - good way to find GC/allocation bugs. *) + Gc.full_major () diff --git a/examples/test.ml b/examples/test.ml index f06fe5b..6ab869b 100644 --- a/examples/test.ml +++ b/examples/test.ml @@ -1,11 +1,14 @@ (* Simple test of the API. * Copyright (C) 2003 Merjis Ltd. - * $Id: test.ml,v 1.4 2003-10-16 08:54:56 rich Exp $ + * $Id: test.ml,v 1.5 2003-10-16 11:03:52 rich Exp $ *) open Printf let () = + (* Perform a full collection - good way to find bugs in initialization code*) + Gc.full_major (); + (* Load "test.pl". *) Perl.eval "require 'examples/test.pl'"; @@ -46,4 +49,7 @@ let () = printf "TestClass.foo is %d\n" (Perl.int_of_sv sv); flush stdout; (* Destroy the interpreter. *) - Perl.destroy (Perl.current_interpreter ()) + Perl.destroy (Perl.current_interpreter ()); + + (* Perform a full collection - good way to find GC/allocation bugs. *) + Gc.full_major () diff --git a/perl_c.c b/perl_c.c index 57cf650..9056591 100644 --- a/perl_c.c +++ b/perl_c.c @@ -1,6 +1,6 @@ /* Interface to Perl from OCaml. * Copyright (C) 2003 Merjis Ltd. - * $Id: perl_c.c,v 1.6 2003-10-15 16:51:12 rich Exp $ + * $Id: perl_c.c,v 1.7 2003-10-16 11:03:51 rich Exp $ */ #include @@ -48,7 +48,7 @@ perl4caml_init (value unit) { CAMLparam1 (unit); PERL_SYS_INIT3 (NULL, NULL, NULL); - return Val_unit; + CAMLreturn (Val_unit); } CAMLprim value @@ -56,7 +56,7 @@ perl4caml_current_interpreter (value unit) { CAMLparam1 (unit); if (my_perl == 0) raise_not_found (); - return Val_perl (my_perl); + CAMLreturn (Val_perl (my_perl)); } static void