Mail Archives: djgpp/1998/09/21/22:20:50
"George Foot" <george DOT foot AT merton DOT ox DOT ac DOT uk> writes:
> Does anyone know where the source code to NTBIND can be found?
> I want to add some switches to it -- at the moment it makes
> console applications if it finds a `main' function, whether or
> not a `WinMain' exists, and I need a switch to tell it exactly
> what type of application to make. This is because WinAllegro
> provides a wrapper WinMain function that calls `main' as if the
> program was a normal console application. I can't use this
> wrapper because as soon as I make `main' NTBIND decides it
> really is a console application.
You can add the following code to "allegro.h":
#ifdef __WINDOWS__ /* Not sure about __WINDOWS__ define. */
int _Wrapper_for_main ();
#define main _Wrapper_for_main
#endif
And then in WinMain either include "allegro.h" and call `main' or call
`_Wrapper_for_main' directly. This code in the header should be
inside `extern "C" {}' construct and user program must include
"allegro.h" in the module which declares `main', but I think that
including "allegro.h" in every file in project is required, as it may
provide compatibility between different platforms.
Users might be confused by getting error messages from compiler
that point to `_Wrapper_for_main' which is not in the source file, so
this wrapping can be documented somewhere.
--
Michael Bukin
- Raw text -