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

"Daniel Walter" <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.