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

Andrew Haley aph@redhat.com
Tue Dec 16 10:39:00 GMT 2008


Daniel Walter wrote:
> Whenever I add an object file that was generated with gcj to a g++ link
> command for a shared dll, I get an undefined reference to `WinMain@16'.
> This seems to indicate that for some reason gcc wants to build an
> executable instead of a shared library.  This was working in gcc 3.4 -
> though I was using cygwin with gcj -mno-cygwin which is no longer
> supported.
> 
> Is building dlls with g++ and gcj supported in newer versions of gcc?
> Is there a different link command that will not try to build an executable?
> 
> 
> works> g++ -shared cpptest.o -o pdflib.dll
> 
> works - event with lgcj> g++ -shared cpptest.o -lgcj -lws2_32 -o pdflib.dll
> 
> fails - it tries to build an executable> g++ -shared javatest.o cpptest.o -lgcj -lws2_32 -o pdflib.dll

More information needed.  'g++ -v' will show you what is being linked.
There is presumably a way to ask what symbols are needed by the various
libraries that you're linking, so have a look which one needs `WinMain@16'.

Andrew.



More information about the Java mailing list