[gambit-list] Re: C interface: wrong types generated?

Marc Feeley feeley at iro.umontreal.ca
Sat Dec 31 01:05:09 EST 2005


On 27-Dec-05, at 3:46 PM, Bradley Lucier wrote:

> The problem seems to be in these lines in gambit.h:
>
> #if CHAR_MAX == SCHAR_MAX
> #define ___SCHAR char
> #else
> #define ___SCHAR signed char
> #endif
>
> I don't know why Marc thinks he needs these lines; I replaced them  
> with
>
> #define ___SCHAR signed char
>
> and all was well ...

The above fragment of gambit.h is needed to allow some old C  
compilers which do not support "signed char" to compile Gambit.  As I  
recall Sun' cc compiler on m68k had this problem.

I've fixed the problem by replacing that fragment with

#ifndef ___SCHAR
#define ___SCHAR signed char
#endif

This should work on modern C compilers, and for old ones the option "- 
D___SCHAR=char" can be added to the C compiler's command line to  
compile Gambit.

On a related subject, I have added the "wchar_t" type to the FFI (and  
wchar_t-string, nonnull-wchar_t-string, ...).  This is useful for  
portability (on some C compilers wchar_t is 16 bits and on others it  
is 32 bits, this is now completely transparent to Scheme code).

Marc




More information about the Gambit-list mailing list