This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]