Ed Hartnett wrote: > My C library builds fine, but when it tries to build the very first > test, it fails, because it tries to link to libnetcdf.lib instead of > libnetcdf-4.dll. > > This is strange to me. I don't understand why, under MingW, this > works: > > gcc -g -O2 -o .libs/t_nc.exe t_nc-t_nc.o ./.libs/libnetcdf-4.dll > -L/usr/local/lib > > And this doesn't: > > gcc -g -O2 -o .libs/t_nc.exe t_nc-t_nc.o ./.libs/libnetcdf.lib > -L/usr/local/lib > > When libnetcdf-4.dll and libnetcdf.lib are copies of each other. In > fact, the names has to end with ".dll" or the link fails. Here's the > versions of gcc and ld:
Something is horribly wrong if the .lib is the same as the .dll. That is not how it works. The .lib file is supposed to be an import library, same as the .dll.a file. They are just two different names for the exact same thing. I don't know why you're bothering with a .def file, either. You can simply do -Wl,--out-implib,foo.dll.a to have the import library created at the same time as the .dll. You can rename/copy foo.dll.a to foo.lib if you want for MSVC people, they are exactly the same thing. Brian _______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool