delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/08/05:16:29

From: Michael Goffioul <goffioul AT emic DOT ucl DOT ac DOT be>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: RSXNTDJ 1.3.1
Date: Wed, 08 Oct 1997 09:50:02 +0200
Organization: EMIC - UCL
Lines: 63
Message-ID: <343B3B2A.6729@emic.ucl.ac.be>
References: <Pine DOT OSF DOT 3 DOT 95 DOT 971007081054 DOT 19645C-100000 AT leonis DOT nus DOT sg> <343af5430252002 AT bj DOT col DOT com DOT cn>
NNTP-Posting-Host: ns2.emic.ucl.ac.be
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

tanph AT bj DOT col DOT com DOT cn wrote:
> 
> I want to do Win32 programming using DJGPP, so I downloaded RSXNTDJ
> 1.3.1 and  installed it  according to its installation guidance.
> 
> Using "gcc -Zwin32 test.c -o test.exe",  I can compile and link and
> run the following test program successfully.
> 
> /* test.c */
> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE
> hPrevInstance, LPSTRlpCmdLine, int nCmdShow)
> {
>   MessageBox (NULL, "Hello Win32", "First App", MB_OK);
>   return 0;
> }
> 
> But, for the non-Win32 file x.c below,
> 
> /* x.c */
> int x()
> {
> /* empty */
> }
> 
> I use "gcc -o x.exe x.c" to compile and link it. It weirdly gives
> no error message and  generates the executable x.exe. Surely, this is
> wrong, for there is no main() at all.
> 
> Can anyone give me an explanation?
> Thanks in advance.
> 
> P.H. Tan

The RSXNT package has his own linker 'ld.exe' which replace the normal
linker of Djgpp. This linker does not check for undefined references
(some functions,variables,... are linked dynamically) at compile time.
So the compiler doesn't complain when compiling such a code.
But, try to run the executable and you'll get some errors !

One way to solve this is to have both linkers available and to have
two environement file: one 'dos32.env' with djgpp linker specified,
and the other 'win32.env' with the rsxnt linker specified. When you
want to compile dos code

	set DJGPP=C:\DJDIR\DOS32.ENV

and for windows code

	set DJGPP=C:\DJDIR\WIN32.ENV

Hope this help.

-- 
Michael Goffioul

EMIC - UCL
Batiment Maxwell
Place du Levant, 3
B-1348 Louvain-la-Neuve
Belgium

Tel.: +32 10 47 23 15
Fax.: +32 10 47 87 05

- Raw text -


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