This problem is described in: http://gcc.gnu.org/ml/java/2003-11/msg00055.html I tried the patch referred to in this thread, and my application links, but it crashes when I try to call one of the functions in the DLL.
More info: http://gcc.gnu.org/ml/java/2003-11/msg00112.html
This appears to be a more general(not Java specific) compatibility problem between Visual C++ 6.0 and GCC. I'll attach foo.c and bar.c 1. gcc -shared -o bar.dll -Wl,--out-implib,foo.lib bar.c 2. gcc -o foo foo.c bar.lib When I compile 2. from VC++, I get an error message and the application crashes when it tries to invoke bar(): --------------------Configuration: test2 - Win32 Debug-------------------- Compiling... foo.c Linking... bar.lib(d000001.o) : warning LNK4078: multiple ".text" sections found with different attributes (E0000020) test2.exe - 0 error(s), 1 warning(s)
Created attachment 5106 [details] First example file
Created attachment 5107 [details] Second example file
I tested with GCC 3.3 and the VC++ application still crashes when it tries to invoke bar().
Created attachment 5108 [details] If I generate bar.lib from VC++, everything works
The --out-implib part is not a gcc bug but rather a binutils bug, report it to them also.
This is a known bug in the MS linker: it does not understand GNU ld import libs. To workaround, build an import lib for MS using a .def file containing the exports and the MS programme (I think it is called lib.exe) that does what GNU dlltool does. I think that this also applies in general to any other windows linker programme. Danny
>This is a known bug in the MS linker: it does not understand GNU ld import >libs. Will this be fixed at some point? (If not, shouldn't this option be removed from GCC?) >To workaround, build an import lib for MS using a .def file containing the >exports and the MS programme (I think it is called lib.exe) that does what >GNU dlltool does. For now I just used GetProcAddress() explicitly, moving on. :-) Øyvind
Not a GCC bug but rather a binutils bug, report it to them.