Ah, I see, you are talking about MinGW. I thought you were talking about MSVC.
In that case you may generate a .a file, yes. Bill. On 20 June 2015 at 04:12, <sisyph...@optusnet.com.au> wrote: > > From: 'Bill Hart' via mpir-devel > Sent: Saturday, June 20, 2015 12:46 AM > To: mpir-devel > Subject: Re: [mpir-devel] Re: MPIR MinGW installation - "undefined > reference to '_imp____gmpz_init' > > >I've built mingw-compatible import libs from dynamic libs in the past >> >with: >> >>> >>> gendef xxxx.dll (creates xxxx.def) >>> dlltool --kill-at --input-def xxxx.def--output-lib libxxxx.a >>> >> > [snip] > > So that second line creates a .a file? >> > > Yes - it produces an import library (or "stub library", as Brian called > it) for the given dll. > > I can't see that as a necessary step in the creating of a dynamic library >> for use on Windows. Are you sure this step is required/correct? >> > > Normally it's not needed, as the process that built the dll usually also > builds the import library. > But if you happen to have a dll without an accompanying import library, > then the above allows you to create the import library using only the dll. > (I think there are other convenient ways, in addition to gendef, of > creating the def file.) > > As Brian said, it's possible to link directly to the dll, but most build > processes (eg configure scripts, cmake) will be looking for the import > library, rather than the dll itself. And it's generally far easier to > create the import library (if you don't already have it) than it is to > modify that build process such that the import library is not needed. > At runtime, of course, only the dll needs to be found. > > With MinGW, both static and import libraries will have the ".a" extension. > Often, the import library is named ".dll.a" - ie "libxxxx.a" being a > static library, and "libxxxx.dll.a" being the import library for the dll. > And "-lxxxx" will enable linking to either the static or import library. > (Not sure which gets found first - I'm guessing it looks for the static > library before looking for the import library.) > > IIRC, MinGW used to (and may still) look for ".lib" files. So "-lxxxx" > would seek out an appropriately named ".lib" file if no appropriately named > ".a" file could be found. > > I've definitely mixed msvc-built libraries with mingw (and vice-versa, I > *think*) in the past, but that was before gcc-4.x.x, and before 64-bit > mingw compilers, and I can't remember whether it involved static libs, > import libs, or both. > (And it certainly didn't involve C++ libraries.) > > > Cheers, > Rob > -- > You received this message because you are subscribed to the Google Groups > "mpir-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to mpir-devel+unsubscr...@googlegroups.com. > To post to this group, send email to mpir-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/mpir-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "mpir-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to mpir-devel+unsubscr...@googlegroups.com. To post to this group, send email to mpir-devel@googlegroups.com. Visit this group at http://groups.google.com/group/mpir-devel. For more options, visit https://groups.google.com/d/optout.