[gambit-list] printf and the C interface

Cristian Baboi cristi at ot.onrc.ro
Thu Jun 19 09:03:33 EDT 2008

> Cristian Baboi wrote:

>> This is my first try to use the C interface of gambit-c.
>> I used gambit-c 4.2.8 and mingw gcc compiler from CodeBlocks under  
>> Windows
>> XP.
>> Running alt.exe, I get:
>> Hello World!
>>  from C
>> begin
>> 137end
>> The lines printed from the C function appear before the lines printed by
>> scheme.
>> I have two questions:
>> 1) Why the output lines do not appear in the call order ?
> I guess you solved your problem, by looking at your 2nd email.

I solved it by moving to an other O.S. :-)
I've not solved it in Windows XP.

>> 2) Is this the correct way to get small executables with gambit-c or it
>> can be done in a better way ?
> I'm not sure about the size of the executable, but I can give you some  
> tips on
> compiling scheme programs and writing ffi. ;)

Thank you.
The sizes I get are: 6.50 KB for the executable and 2.98 MB for the  

I compiled your modified files on Windows and I still get:
Hello World!
 from C

I compiled test.scm in libtest.dll (2.98 MB - includes all gambitc  
library) and alt.scm in alt.exe (6.50 KB)
I have not tryed to make only a single executable file as you did.

> You would just need to change to compile flags to match thoses
> required by windows (-lws2_32, etc...). Again, I don't know if this
> results in the smallest executable but this is the way I compile my
> scheme program into executables (I usually compile the .c to .o
> seperately, but this does not change much).

On Linux I've got libtest.so - 6.4 KB, alt.exe - 6.6 KB striped and  
libgambc.so - 4.2 MB unstriped

> I hope I could help you a bit!

Thank you!

________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
  part000.txt - is OK

More information about the Gambit-list mailing list