From: Paul M. <pf_...@ya...> - 2003-08-01 20:04:43
|
Earnie Boyd <ear...@ya...> writes: > Moore, Paul wrote: >> From: Earnie Boyd [mailto:ear...@ya...] >> >>>>To elaborate on that, if you have access to "msvcr71.dll" you can: >>>> >>>>a. create an import library for this DLL (or take an existing one) and >> >>> Well, modifying the top level Makefile.in to add a target >>> msvcr71.def for the msvcrt.def.in dependency would work. >> > > I did the above suggestion. Try the attached. > >> I got a def file using pexports, and then a lib file via dlltool: >> pexports msvcr71.dll >msvcr71.def >> dlltool --dllname msvcr71.dll --def msvcr71.def --output-lib libmsvcr71.a >> >>>I wouldn't do that, just adding -lmsvcr71 to the link step would suffice. >> Trying that, I got: >> C:> gcc -O2 -L. -lmsvcr71 -o hello.exe hello.c This is from a long time back. Sorry for this... I have been fine building msvcr7-compatible files using the libmsvcr71.a that you sent me. Unfortunately, I lost the file in a disk reshuffle, and rather than searching through the mailing list archives for this message, I tried creating my own copy via pexports/dlltool as above. However, when I did, I started getting the errors I mentioned (below) again. >> ./libmsvcr71.a(ds00649.o)(.text+0x0): multiple definition of `atexit' >> C:/Apps/Mingw/bin/../lib/gcc-lib/mingw32/3.2.2/../../../crt2.o >> (.text+0x40):crt1.c: first defined here >> ./libmsvcr71.a(ds00440.o)(.text+0x0): multiple definition of `_onexit' >> C:/Apps/Mingw/bin/../lib/gcc-lib/mingw32/3.2.2/../../../crt2.o >> (.text+0x60):crt1.c: first defined here >> I don't know if this is a problem with me trying to do something too >> simple, or a fundamental issue... I ended up getting your version from the list archive, in the end. When I did, I decided to try to dig a bit deeper. Doing nm on both your version (libmsvcr71.a) and mine (libmsvcr71.a.new) I see a difference in the defintions of atexit and onexit, as follows: >nm libmsvcr71.a | grep -E "(at|on)exit" 00000000 I __imp__atexit 00000000 I __imp___onexit 00000000 T ___dllonexit 00000000 I __imp____dllonexit >nm libmsvcr71.a.new | grep -E "(at|on)exit" 00000000 I __imp__atexit 00000000 T _atexit 00000000 I __imp___onexit 00000000 T __onexit 00000000 T ___dllonexit 00000000 I __imp____dllonexit Note that my version (from dlltool) has "T" type symbols _atexit and __onexit. (There are actually quite a few other differences, but these two seem to be the ones which produce the errors...) I assume that your method ("modifying the top level Makefile.in") requires building mingw/gcc/something from source (sorry, I've never looked at the source of mingw, so I may have the details wrong). But nothing I do with dlltool (ie, at a user level) lets me get rid of those _atexit and __onexit symbols. I believe that it would be really useful for users to be able to obtain a working libmsvcr71.a - as VC7 becomes more widespread, executables built with it will become more common, and being able to build compatible extension DLLs with mingw will become more important. One option is for libmsvcr71.a to be distributed with mingw - it isn't at the moment in mingw 3.0.0 rc3, and I don't know if there would be any license issues with including it. The other option is to work out how users can build their own import library, with the tools supplied. (This has a further, possibly minor, advantage of allowing users to build libmsvcr72.a when VC 7.2 appears, without needing to wait for an "official" mingw release). I'm absolutely stumped as to how to get dlltool to omit these two symbols from my generated libmsvcr71.a - any ideas? Thanks, Paul. -- This signature intentionally left blank |