[gambit-list] Gambit on Windows with no console window
Marc Feeley
feeley at iro.umontreal.ca
Mon Apr 9 10:16:13 EDT 2012
On 2012-04-09, at 9:44 AM, REPLeffect wrote:
> So I'm wondering -- has Gambit ever been tested to work without the
> console window? I know you can hide it when calling the
> process-related procedures, but I couldn't find anything in the
> documentation or on the mailing list about the main app not having a
> console.
It is clearly possible, for example the Jedi IDE for JazzScheme is a window application written with Gambit. Perhaps looking at the Jedi sources will give you some ideas.
Also, here's an old message to the Gambit ML which seems related :
https://mercure.iro.umontreal.ca/pipermail/gambit-list/2011-March/004939.html
Finally, I sent a private message on this subject which I should have CC'd to the Gambit ML. It is copied below.
Let me know if you need more assistance.
Marc
Begin forwarded message:
> From: Marc Feeley <feeley at iro.umontreal.ca>
> Subject: Re: [gambit-list] Gambit-C and cygwin
> Date: 20 March, 2011 2:29:57 PM EDT
> To: Valeriya Pudova <valery at digitalchile.net>
> Cc: Mikael More <mikael.more at gmail.com>
>
>
> On 2011-03-20, at 12:46 PM, Valeriya Pudova wrote:
>
>> Hello Mikael,
>>
>> Thanks for your note. That is right. But gsc should add the (main) code to .c file. Is it not?
>
> For portability it is a bit more complicated than that. A typical Unix application has a "main" function which is the entry point of the program. On Windows, for a graphical Windows-based application, the entry point is "WinMain". On the other hand, for a library of code, there is no entry function.
>
> When you compile a Scheme program "foo.scm" with
>
> gsc -link foo.scm
>
> the Gambit compiler will generate two files:
>
> foo.c compilation of foo.scm to C
> foo_.c the "link file" which contains initialization code for linking foo.c to the Gambit runtime library
>
> The link file contains code to define a "main" or "WinMain" function (when an entry function is required). The function "WinMain" will be defined if the symbol _WINDOWS is defined, otherwise the function "main" will be defined. These entry functions call functions in the Gambit runtime to process the command-line arguments, initialize the runtime system, and start the execution of the Scheme program. The definition of these entry functions is conditional. When the symbol ___LIBRARY is defined (usually on the C compiler command line) then no entry function will be defined. This is useful for libraries.
>
>> Also, I need a console application, and believe that gsc should make this type of application by default.
>
> It should! Perhaps you have mingw and cygwin installed on the same machine and when you call "gcc" it uses the wrong compiler (and I think the mingw gcc defines _WINDOWS by default). Just a guess. I remember some time ago that someone suggested using a flag line "gcc -mno-mingw" or something to prevent this problem. I'm not a Windows expert, so you need to dig for this yourself to verify.
>
>> Is it not? BTW Which of the gsc's or gambc-cc.bat's arguments change the type of app. console | win ?
>
> It is a question of whether _WINDOWS is defined when the link file is compiled by the C compiler.
>
> Marc
More information about the Gambit-list
mailing list