This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: creating shared dlls yields undefined reference to `WinMain@16' in mingw 4.3
- From: Andrew Haley <aph at redhat dot com>
- To: Daniel Walter <d2walter at hotmail dot com>
- Cc: java at gcc dot gnu dot org
- Date: Tue, 16 Dec 2008 10:39:15 +0000
- Subject: Re: creating shared dlls yields undefined reference to `WinMain@16' in mingw 4.3
- References: <BLU138-DAV8188D9A7984D9F7DF77CB80F50@phx.gbl>
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.