[gambit-list] __cleanup() problem (OS X 10.6.6 / Gambit-C 4.6.0)
David Dreisigmeyer
dwdreisigmeyer at gmail.com
Wed Jan 12 00:05:17 EST 2011
Hi,
If I use the modified version of client.c and test8.ok below in
gambit/tests I get the following:
$ make check
......
7d6
< Cleanup successful
make: *** [test8] Error 1
$
If I keep the executable client from make check the following happens:
$ ./client
result = #!void
result = 1606938044258990275541962092341162602522202993782792835301376
result = #<datum-parsing-exception #2>
result = #<unbound-global-exception #3>
Starting cleanup...1
Starting cleanup...2
$
Should "Cleanup successful" (see client.c below) be printed after the
call to __cleanup()? This might be causing the problem of calling
__cleanup() from Python.
Thanks,
-Dave
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
** test8.ok:
result = #!void
result = 1606938044258990275541962092341162602522202993782792835301376
result = #<datum-parsing-exception #2>
result = #<unbound-global-exception #3>
Starting cleanup...1
Starting cleanup...2
Cleanup successful
** client.c:
/* File: "client.c", Time-stamp: <2007-09-12 00:07:21 feeley> */
/* Copyright (c) 1996-2007 by Marc Feeley, All Rights Reserved. */
#include <stdio.h>
#include <stdlib.h>
/*
* ___VERSION must match the version number of the Gambit header file.
*/
#define ___VERSION 406000
#include "gambit.h"
/*
* Include declarations exported by server.
*/
#include "server.h"
/*
* Define SCHEME_LIBRARY_LINKER as the name of the Scheme library
* prefixed with "____20_" and suffixed with "__". This is the
* function that initializes the Scheme library.
*/
#define SCHEME_LIBRARY_LINKER ____20_server__
___BEGIN_C_LINKAGE
extern ___mod_or_lnk SCHEME_LIBRARY_LINKER (___global_state_struct*);
___END_C_LINKAGE
int main (int argc, char **argv)
{
char *temp;
/*
* Setup the Scheme library by calling "___setup" with appropriate
* parameters. The call to "___setup_params_reset" sets all parameters
* to their default setting.
*/
___setup_params_struct setup_params;
___setup_params_reset (&setup_params);
setup_params.version = ___VERSION;
setup_params.linker = SCHEME_LIBRARY_LINKER;
___setup (&setup_params);
/* Main part of program: call Scheme functions */
temp = eval_string ("(define x 200)");
if (temp != 0)
{
printf ("result = %s\n", temp);
___release_string (temp); /* don't forget to reclaim string */
}
temp = eval_string ("(expt 2 x)");
if (temp != 0)
{
printf ("result = %s\n", temp);
___release_string (temp);
}
temp = eval_string ("(+ 1 2"); /* note: missing closing parenthesis */
if (temp != 0)
{
printf ("result = %s\n", temp);
___release_string (temp);
}
temp = eval_string ("(+ x y)"); /* note: y is unbound */
if (temp != 0)
{
printf ("result = %s\n", temp);
___release_string (temp);
}
fflush (stdout);
/* Cleanup the Scheme library */
printf ("Starting cleanup...1\n");
fflush (stdout);
printf ("Starting cleanup...2\n");
fflush (stdout);
___cleanup ();
printf ("Cleanup successful\n");
fflush (stdout);
return 0;
}
More information about the Gambit-list
mailing list