creating shared dlls yields undefined reference to `WinMain@16' in mingw 4.3

Daniel Walter d2walter@hotmail.com
Tue Dec 16 20:11:00 GMT 2008


I tried adding -Wl,-y,_WinMain@16 so that I could find out where this 
reference was missing.  The result was main.o - this was also in the 
previous output.

I am not sure this is the best way to do things, but I did an objdump on my 
dlljava.o test file that produced some symbols.  I then tried to link 
without dlljava.o, but with -Wl,-u which forces the linker to resolve a 
symbol.  It failed as soon as I used symbols that were in libgcj.a - 
particularly java.lang.Object when I used the symbol 
__ZN4java4lang6Object6class$E.

I also tried making a WinMain and putting it in a C++ file.  This allowed it 
to link a dll, but this may be causing other problems and is not really my 
desired solution.

Daniel


----- Original Message ----- 
From: "Andrew Haley" <aph@redhat.com>
To: "Daniel Walter" <d2walter@hotmail.com>
Cc: <java@gcc.gnu.org>
Sent: Tuesday, December 16, 2008 12:29 PM
Subject: Re: creating shared dlls yields undefined reference to `WinMain@16' 
in mingw 4.3


> Daniel Walter wrote:
>> It appears that libmingw.a is causing the problem, though this library
>> can be linked to form a dll as long as no gcj object files are linked as
>> well. Below are the results of the attempts to link with 'g++ -v' first
>> with gcj objects which failed and the second time with only g++ objects.
>
> So, which object file in libmingw.a contains the undefined reference to
> `WinMain@16'  And what dependency is causing it to be pulled in?
>
> Andrew.
> 



More information about the Java mailing list