Actions

Difference between revisions of "Compiling Gambit software for different target environments"

From Gambit wiki

(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...)
 
Line 13: Line 13:
 
:gsc -link test
 
: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.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
+
:cl -Fetest.exe test.obj test_.obj C:\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 .
 
Voillas. The key recipe in here is to pass -D_WINDOWS to cl.exe, and /subsystem:windows to link.exe .
 +
 +
Upon any (display) (force-output) you do, a console window will be allocated.
 +
 +
Pass -dr:- to force the app open a console.

Revision as of 14:01, 18 December 2008

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:\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 .

Upon any (display) (force-output) you do, a console window will be allocated.

Pass -dr:- to force the app open a console.