delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/21/22:20:50

From: M DOT A DOT Bukin AT inp DOT nsk DOT su
To: djgpp AT delorie DOT com
Cc: george DOT foot AT merton DOT ox DOT ac DOT uk
Subject: Re: DJGPP and windows?
References: <199809211907 DOT UAA13417 AT rochefort DOT ns DOT easynet DOT net>
Date: 22 Sep 1998 09:08:46 +0700
In-Reply-To: "George Foot"'s message of "Mon, 21 Sep 1998 20:00:16 +0000"
Message-ID: <20ogs8oq4x.fsf@Sky.inp.nsk.su>
Lines: 32

"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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019