octave-maintainers
[Top][All Lists]
Advanced

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

Re: Do we need "DEFINES=-DWIN32 -DGSL_DLL" in the Makefile of the gsl pa


From: Michael Goffioul
Subject: Re: Do we need "DEFINES=-DWIN32 -DGSL_DLL" in the Makefile of the gsl package?
Date: Mon, 5 Sep 2016 09:47:15 -0400

The necessity of GSL_DLL macro is to deal with DLL-exported variables (not functions) and MSVC compiler (and other compilers that use the same dynamic linking rules).

A DLL-exported function can be found by the linker using 2 symbols: NAME and _imp_NAME. A DLL-exported variable can only be found by the linker with _imp_VAR. When using MSVC, if the variable is not decorated with __declspec(dllimport), the linker will fail. When using GCC, the linker uses some magic bootstrap to make the variable be found by the linker with VAR symbol only.

Keeping the define's is harmless with GCC (as GCC can deal with MSVC conventions).

Michael.



On Mon, Sep 5, 2016 at 9:38 AM, Julien Bect <address@hidden> wrote:
Le 05/09/2016 à 15:35, Julien Bect a écrit :
The lines that we are currently discussing are in Makefile.in, which is turned into a proper Makefile by configure.

Are there really people out that use configure (produced by autoconf) in conjunction with MSVC? Is that even possible?

"people out there", I mean...


@++
Julien


PS : I have found the following lines in gsl_types.h:

#ifndef GSL_VAR

#ifdef WIN32
#  ifdef GSL_DLL
#    ifdef DLL_EXPORT
#      define GSL_VAR extern __declspec(dllexport)
#    else
#      define GSL_VAR extern __declspec(dllimport)
#    endif
#  else
#    define GSL_VAR extern
#  endif
#else
#  define GSL_VAR extern
#endif





reply via email to

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