If this is a FAQ, sorry.
I'm trying to use Gambit-C to get an executable version of a Scheme program. I'm comfortable with Scheme, but haven't used C in many years.
I'm running Windows XP. I downloaded Gambit-C, version 4.0 beta 9. I've succeeded in using Gambit to translate foo.scm into foo.c.
After quite a while looking for documentation I'm still clueless as to how to compile and link foo.c. I've tried both MS Visual Studio and Watcom-1.3.
Any help will be greatly appreciated.
Afficher les réponses par date
On Tue, 11 Jul 2006, Kenneth Kellum wrote:
I'm running Windows XP. I downloaded Gambit-C, version 4.0 beta 9. I've succeeded in using Gambit to translate foo.scm into foo.c.
After quite a while looking for documentation I'm still clueless as to how to compile and link foo.c. I've tried both MS Visual Studio and Watcom-1.3.
I'm not familiar with using Gambit under Windows, but the easiest way to deal with compiled code with Gambit is to use dynamic libraries. For example:
% gsc -dynamic foo.scm ... generates foo.o1 % gsi foo ... runs the compiled foo module
Using gcc, to generate a standalone executable you do something like:
% gsc foo.scm ... generates foo.c and foo_.c % gcc -o foo foo.c foo_.c -lgambc -lm -ldl -lutil ... generates the foo executable % ./foo ... runs foo
Hope that helps,
Guillaume
Thanks. The Windows version of Gambit doesn't seem to like the -dynamic switch.
The error I get is 'C:\Gambit-C\bin\gsc-cc-o is not recognized as an internal or external command ...'
Guillaume Germain wrote:
On Tue, 11 Jul 2006, Kenneth Kellum wrote:
I'm running Windows XP. I downloaded Gambit-C, version 4.0 beta 9. I've succeeded in using Gambit to translate foo.scm into foo.c.
After quite a while looking for documentation I'm still clueless as to how to compile and link foo.c. I've tried both MS Visual Studio and Watcom-1.3.
I'm not familiar with using Gambit under Windows, but the easiest way to deal with compiled code with Gambit is to use dynamic libraries. For example:
% gsc -dynamic foo.scm ... generates foo.o1 % gsi foo ... runs the compiled foo module
Using gcc, to generate a standalone executable you do something like:
% gsc foo.scm ... generates foo.c and foo_.c % gcc -o foo foo.c foo_.c -lgambc -lm -ldl -lutil ... generates the foo executable % ./foo ... runs foo
Hope that helps,
Guillaume _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca http://mailman.iro.umontreal.ca/mailman/listinfo/gambit-list
First of all beta 9 is quite old and it has a few known bugs on Windows. You should use beta 17.
After a "./configure" and a "make" and a "make install", Gambit-C will be installed in:
c:/msys/1.0/local/Gambit-C
Then you can compile a standalone program like this:
feeley@NEO-XP ~/gambc40b17 $ cat foo.scm (display "hello world\n")
feeley@NEO-XP ~/gambc40b17 $ c:/msys/1.0/local/Gambit-C/bin/gsc foo.scm
feeley@NEO-XP ~/gambc40b17 $ gcc -I c:/msys/1.0/local/Gambit-C/include foo.c foo_.c c:/msys/1.0/ local/Gambit-C/lib/libgambc.a -lws2_32
feeley@NEO-XP ~/gambc40b17 $ a.exe -:tc hello world
Of course you can put c:/msys/1.0/local/Gambit-C/bin in your PATH to access gsi and gsc easier.
As Guillaume Germain mentioned it is probably easier to compile your program dynamically and load it using the interpreter:
feeley@NEO-XP ~/gambc40b17 $ c:/msys/1.0/local/Gambit-C/bin/gsc -dynamic foo.scm
feeley@NEO-XP ~/gambc40b17 $ c:/msys/1.0/local/Gambit-C/bin/gsi -:tc foo hello world
Note that the -:tc option is a temporary work around for a bug on Windows.
Marc
On 11-Jul-06, at 9:57 AM, Kenneth Kellum wrote:
If this is a FAQ, sorry.
I'm trying to use Gambit-C to get an executable version of a Scheme program. I'm comfortable with Scheme, but haven't used C in many years.
I'm running Windows XP. I downloaded Gambit-C, version 4.0 beta 9. I've succeeded in using Gambit to translate foo.scm into foo.c.
After quite a while looking for documentation I'm still clueless as to how to compile and link foo.c. I've tried both MS Visual Studio and Watcom-1.3.
Any help will be greatly appreciated. _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca http://mailman.iro.umontreal.ca/mailman/listinfo/gambit-list
Thanks:
I downloaded beta 17, but thus far haven't been able to build Gambit-C.
I looked at the openwatcom.bat file. I changed @SET WATCOM=C:\WATCOM to @SET WATCOM=C:\WATCOM-1.3.
I ran openwatcom in a Command prompt window. It ran for a bit, but then gave a bunch of errors starting with
Error! E2008: cannot open ..\lib\main.obj : No such file or directory
I also tried changing the watcom director name, but got the same errors.
I've tried Cygwin with no more success.
I'm stuck.
Marc Feeley wrote:
First of all beta 9 is quite old and it has a few known bugs on Windows. You should use beta 17.
After a "./configure" and a "make" and a "make install", Gambit-C will be installed in:
c:/msys/1.0/local/Gambit-C
Then you can compile a standalone program like this:
feeley@NEO-XP ~/gambc40b17 $ cat foo.scm (display "hello world\n")
feeley@NEO-XP ~/gambc40b17 $ c:/msys/1.0/local/Gambit-C/bin/gsc foo.scm
feeley@NEO-XP ~/gambc40b17 $ gcc -I c:/msys/1.0/local/Gambit-C/include foo.c foo_.c c:/msys/1.0/ local/Gambit-C/lib/libgambc.a -lws2_32
feeley@NEO-XP ~/gambc40b17 $ a.exe -:tc hello world
Of course you can put c:/msys/1.0/local/Gambit-C/bin in your PATH to access gsi and gsc easier.
As Guillaume Germain mentioned it is probably easier to compile your program dynamically and load it using the interpreter:
feeley@NEO-XP ~/gambc40b17 $ c:/msys/1.0/local/Gambit-C/bin/gsc -dynamic foo.scm
feeley@NEO-XP ~/gambc40b17 $ c:/msys/1.0/local/Gambit-C/bin/gsi -:tc foo hello world
Note that the -:tc option is a temporary work around for a bug on Windows.
Marc
On 11-Jul-06, at 9:57 AM, Kenneth Kellum wrote:
If this is a FAQ, sorry.
I'm trying to use Gambit-C to get an executable version of a Scheme program. I'm comfortable with Scheme, but haven't used C in many years.
I'm running Windows XP. I downloaded Gambit-C, version 4.0 beta 9. I've succeeded in using Gambit to translate foo.scm into foo.c.
After quite a while looking for documentation I'm still clueless as to how to compile and link foo.c. I've tried both MS Visual Studio and Watcom-1.3.
Any help will be greatly appreciated. _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca http://mailman.iro.umontreal.ca/mailman/listinfo/gambit-list
Gambit-list mailing list Gambit-list@iro.umontreal.ca http://mailman.iro.umontreal.ca/mailman/listinfo/gambit-list