Mail Archives: djgpp/1997/10/08/05:16:29
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 -