Wow!
This generates gcc-unfriendly braindamage in the .c file,
so that has to be changed:
scheme_value df_dbm_close(long nargs, scheme_value *args)
{
extern void dbm_close(DBM* );
scheme_value ret1;
long r1;
cig_check_nargs(2, nargs, "dbm_close");
dbm_close((DBM* )AlienVal(args[1]));
r1=0;
ret1 = VECTOR_REF(*args,0);
AlienVal(ret1) = (long) r1;
return ret1;
}
the changes here involved changing "void r1;" and
getting rid of "r1=" from in front of the call to
dbm_close function, and adding in "r1=0" afterwards.
Actually, you would be better to just completely punt r1:
scheme_value df_dbm_close(long nargs, scheme_value *args)
{
extern void dbm_close(DBM* );
scheme_value ret1;
cig_check_nargs(2, nargs, "dbm_close");
dbm_close((DBM* )AlienVal(args[1]));
ret1 = VECTOR_REF(*args,0);
AlienVal(ret1) = 0;
return ret1;
}
The problem here is that I didn't design cig to generate foreign-function
calls that return no value at all. I should fix this.
A check for errno or something to adjust the return
value might be wise, but this was quicker.
Yes, that is the better fix.
-Olin
|