Compiling Gambit software for different target environments
From Gambit wiki
Revision as of 13:59, 18 December 2008 by Mikaelm (New page: === How to build GUI apps for Win32 === The misc\vcexpress.bat file, used as described in INSTALL, both found in the source repo file are good sources of inspiration on how to build Gambit...)
How to build GUI apps for Win32
The misc\vcexpress.bat file, used as described in INSTALL, both found in the source repo file are good sources of inspiration on how to build Gambit apps using MSVC.
Here's a good GUI example app for win32, call it test.scm:
- (c-declare "#include <windows.h>")
- (define message-box (c-lambda (UTF-8-string) void "MessageBox(0,___arg1,\"Dbg\",0);"))
- (message-box "Hi!")
In order to compile it, first run misc\vcexpress to get lib\libgambc.lib . Then do:
- C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall
- gsc -link test
- cl.exe -Fetest.exe -nologo -Oityb1 -MT -D_CRT_SECURE_NO_DEPRECATE -c -I"C:\gambc-v4_3_2-devel\include" -I"C:\gambc-v4_3_2-devel\lib" -D___SINGLE_HOST -D_WINDOWS "test_.c" "test.c"
- cl -Fetest.exe test.obj test_.obj C:\cygwin\home\Mikael\gambc-v4_3_2-devel\lib\libgambc.lib Kernel32.Lib User32.Lib Gdi32.Lib WS2_32.Lib /link /subsystem:windows
Voillas. The key recipe in here is to pass -D_WINDOWS to cl.exe, and /subsystem:windows to link.exe .