On 19 June 2015 at 16:10, <highcalcula...@gmail.com> wrote:

> 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>).
>
>

I think libmpir-3.dll sounds old. The one you want to convert is the
libmpir-16.dll, in my opinion.


> 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
>

You shouldn't need the mpf directory in this command, nor the printf
directory.

But as I don't know anything about mex, I can't really help with figuring
out how to use it.

But as a general observation, I don't see where you are telling it what
library to use. There could be 100 libraries in that .libs directory.
Somehow I would guess it needs to know which one to use.


>
> 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?
>

You already have an mpir dll, namely libmpir-16.dll.


>
> So, is the file "libmpir.lib" (or "libmpir.lib") needed and missing?
>

As explained, it's needed, but not missing. You have to create it yourself
with the lib tool or the gnu tool mentioned.


> 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?
>

That looks right for creating a dll. Since you have one, I guess you did
that correctly.

Anyhow the error message above suggests something is linking against MPIR
but the linker is somehow looking for an internal symbol (it's something to
do with the complicated way symbols are handled in MinGW). This could be
because your system PATH is not set to include the directory where the dll
file is. Thus the Windows linker cannot find the internal symbols.

Unfortunately, this sort of problem is hard to resolve. I've seen it happen
on Windows when a program links against a library which has additional
dependencies. I don't know if that could be happening here.

There are various tools you can use on Windows to see what is missing, e.g.
in the past I got some clues using Dependency Walker and reading lots of
forum posts and documentation of the MinGW linker and the Microsoft linker.

Bill.

Thanks,
> Pat
>
>
> On Friday, June 19, 2015 at 3:51:17 PM UTC+2, leif wrote:
>>
>> sisy...@optusnet.com.au wrote:
>> > From: highcal...@gmail.com
>> > Sent: Friday, June 19, 2015 8:06 PM
>> > To: mpir-...@googlegroups.com
>> > 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.
>

-- 
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.

Reply via email to