Subject: RE: Problems With Undefined In Simple Program
From: [email-masked] (Colin Peters)

4 Dec 1996 21:01:53 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Original-To: "'David Highley'" <[email-masked]>
Original-Cc: "'GNU-Win32'" <[email-masked]>
Original-Sender: [email-masked]

David Highley[SMTP:[email-masked]] wrote:
>I'm trying to compile a simple program on a Win95 system to get around the
>broken cat command and I have not been able to resolve one undefined.
>	WinMain@16
>
>This also leads me to think that gcc is defaulting to 16 bit mode.  This is
>my first attempt to compile any program in the cygnus ported environment. 
>I have done an nm on all libraries in the directory:
>	H-i386-cygwin32/i386-cygwin32/lib
>
>Last I am using beta version 16.  I need to be able to create command that
>will recombine split files.   Thank you for any help you can provide.

WinMain@16 is the internal/pascalized name of WinMain. The 16 simply indicates
the number of bytes on the stack occupied by parameters, included so that the
called function can remove those parameters from the stack (instead of the
calling function as in "C" type calls).

There is magic in the gcc compiler, related to the attribute __stdcall__ I
think, that causes a call to WinMain to become a call to WinMain@16. So, what
is happening here is you do not have a properly prototyped WinMain in your
program.

Point 1: If your immediate response is "but I'm using main" then I am somewhat
puzzled. The only factoid I can add is that if Cygnus did the main/WinMain thing
the same way that I did in the Minimalist GNU-Win32 files (and I think they did)
then an unresolved reference to WinMain also indicates the fact that main is
missing from your program. It doesn't say unresolved reference to main because
it allows you to write apps that use WinMain as the entry point. First it checks
for main, then for WinMain. If neither is found it reports an unresolved reference
to WinMain.

Point 2: The easiest way to make sure that your WinMain is properly prototyped is
to copy the prototype from the windows32api-0.1.2 (or above?) header files (just
do a grep for WinMain in the windows32 header file directory).

I hope this helps you solve your problem. If not, perhaps the best option is to
work it down to the smallest set of source code that you think should work but
doesn't, and give us all a look at it.

Good luck,
Colin.

-- Colin Peters - [email-masked]
-- Saga University Dept. of Information Science
-- Fundamentals of Information Science
-- http://www.fu.is.saga-u.ac.jp/~colin/home.html

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".