Dear All, Thanks for your help. I do not see a file exactly called "libmpir.dll", so if I really need to have "libmpir.lib" sitting in the .libs folder, how would I get the former to convert it via the MS lib tool to the latter? I tried to convert the two existing ".dll" files in the .libs folder, namely "libmpir-3.dll" and "libmpir-16.dll" via the MS lib tool (accessed via cmd) to their respective ".lib" counterparts (eg. using this description <http://asawicki.info/news_1420_generating_lib_file_for_dll_library.html>). Then I used "-lmpir-3" resp. "-lmpir-16" in the mex command, which again returned the "...unresolved external symbol __imp___gmpf_init ..." message. Specifically, I used the command
mex -IC:/MPIR/mpir-2.7.0/ -LC:/MPIR/mpir-2.7.0/.libs/ -LC:/MPIR/mpir-2.7.0/mpf/.libs -LC:/MPIR/mpir-2.7.0/printf/.libs mexlib.c I also tried to add the MPIR root and .libs directories to the LIB and INCLUDE variables in the mexopts.bat settings file, which did not help anything. Rob: The above message, for each mpf_... function, appear if I set the -lmpir or -lmpir-16 flag, but also if I don't. Just changing the extension of "libmpir.la" to "libmpir.lib" did result in a "file corrupt" message after mex, as Bill conjectured. Brian: How would I build an MPIR DLL using the native Microsoft and Intel compilers? Is this here a necessary extra step? So, is the file "libmpir.lib" (or "libmpir.lib") needed and missing? Since the doc states that "-lmpir" needs to be set as a flag in the compile command. Or - I think I ran ./configure with --disable-static --enable-shared; if so, was that wrong? Thanks, Pat On Friday, June 19, 2015 at 3:51:17 PM UTC+2, leif wrote: > > sisy...@optusnet.com.au <javascript:> wrote: > > From: highcal...@gmail.com <javascript:> > > Sent: Friday, June 19, 2015 8:06 PM > > To: mpir-...@googlegroups.com <javascript:> > > Subject: Re: [mpir-devel] Re: MPIR MinGW installation - "undefined > > reference to '_imp____gmpz_init' > > > >> I would like to call it from Matlab using mex files, and there, the > >> compiler complains that it does not see any ".lib" files (when > >> compiling with "mex ... -lmpir" it looks for a file "libmpir.lib") . > > [snip] > >> Compiler answer: > >> "myfile.obj : error LNK2019: unresolved external symbol > >> __imp___gmpf_init referenced in function "void __cdecl myfile(double)" > " > > > > That's interesting ... you've given the directive to link to "-lmpir", > > no such library is found, but instead of croaking then and there the > > process continues anyway ? (I don't know Matlab at all.) > > Well, the non-presence of a library isn't necessarily a fatal error. > Anyway, it's of course better to first keep going to potentially emit > further error messages, in this case the unresolved symbols. > > > [...] > > The fact that your object file is ".obj" instead of ".o" would indicate > > that it's built with a Microsoft Compiler - so, if need be, you should > > be able to build the requisite ".lib" file from the dll using your > > Microsoft Compiler installation's lib tool (as Bill has hinted). > > The 'error LNK2019' certainly comes from a M$ compiler (more precisely, > its linker). > > You can also use GNU Binutils' 'dlltool' to create M$-compatible import > libraries (*.LIB). > > > -leif > > -- 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.