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: "Daniel Walter" <d2walter at hotmail dot com>
- To: "Daniel Walter" <d2walter at hotmail dot com>, "Andrew Haley" <aph at redhat dot com>
- Cc: "Danny Smith" <dansmister at gmail dot com>, <java at gcc dot gnu dot org>
- Date: Wed, 17 Dec 2008 23:12:00 -0500
- Subject: Re: creating shared dlls yields undefined reference to `WinMain@16' in mingw 4.3
Thank you for all the help on this. For anyone who is searching the archives
for MinGW gcj information, I will summarize.
1. If you are trying to build a dll in MinGW, you may need to make a dummy
WinMain function. This should not be exported outside of the dll. This will
get you past the libgcj reference to main/WinMain for backtraces.
2. When statically linking with libgcj
use -Wl,--whole-archive -lgcj -Wl,--no-whole-archive. Adding this forces the
linker to link all of libgcj instead of just the parts that are referenced
by your program. This is important because some parts of libgcj are loaded
via reflexion rather than directly through symbolic references. Your program
will start fine and crash later without this.