emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bignum branch


From: Andy Moreton
Subject: Re: bignum branch
Date: Fri, 10 Aug 2018 08:43:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt)

On Fri 10 Aug 2018, Eli Zaretskii wrote:

>> From: Andy Moreton <address@hidden>
>> Date: Thu, 09 Aug 2018 21:49:46 +0100
>> 
>> c:/msys64/mingw64/include/gmp.h has this (package version 6.1.2-1):
>> 
>>     /* Instantiated by configure. */
>>     #if ! defined (__GMP_WITHIN_CONFIGURE)
>>     #define _LONG_LONG_LIMB 1
>>     #define __GMP_LIBGMP_DLL  0
>>     #endif
>> 
>> That is suitable for linking to a static library. If I change it to look
>> like this:
>> 
>>     /* Instantiated by configure. */
>>     #if ! defined (__GMP_WITHIN_CONFIGURE)
>>     #define _LONG_LONG_LIMB 1
>>     #define __GMP_LIBGMP_DLL  1
>>     #endif
>> 
>> After rebuilding emacs, logcount works, and data-tests passes.
>
> I'd actually prefer us to link against GMP statically, at least on
> Windows, because GMP usually gets replaced when you install a new
> version of GCC.  So linking statically runs a lower risk of a "DLL
> hell".  It also makes the Emacs binary self-contained and more easily
> movable.

Yes. I don't know how to fix the configury and makefiles to ensure it
links against a static library if it is available.

> Why is it a problem with linking statically against GMP?  Could it be
> tat your libgmp.a is from a different GMP version, i.e. incompatible
> with the GMP headers you have installed?  Or maybe some other optional
> library depends on GMP and causes conflicts?  If not, I don't
> understand why the results should depend on how we linked the library.

Building the GMP library builds *different* gmp.h headers when building
for static library vs. a shared library.

The only difference in the headers preduced by the static libary and
shared libary builds is the hunk shown above. The shared library version
(the second hunk above) ensures that APIs get a __dllimport__
decoration for APIs on Windows, for linking to the shared library.

The MSYS2 GMP package includes a single gmp.h header for the static
library build, installed as "c:/msys64/mingw64/include/gmp.h".

Emacs currently links against the shared library on MSYS2 64bit, and has
a dependency on "c:/msys64/mingw64/bin/libgmp-10.dll".

Using the gmp.h header without __dllimport__ API decorations probably
results in incorrect runtime linking to the DLL.

    AndyM






reply via email to

[Prev in Thread] Current Thread [Next in Thread]