bug-gsl
[Top][All Lists]
Advanced

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

Let --enable-shared on MSYS2 generate .dll and .dll.a files


From: Håkon Hægland
Subject: Let --enable-shared on MSYS2 generate .dll and .dll.a files
Date: Sun, 13 Dec 2020 14:04:06 +0100

I am trying to generate Perl wrappers for GSL on Windows 10, MSYS2. These
wrappers are produced by SWIG which produces .dll libraries that are loaded
by Perl at run time. Since configure.ac currently ignores --enable-shared
for MSYS2 and generates only a static libgsl.a library, the the .dll
libraries generated by Perl will each include copies of the global
variables in libgsl.a. For example, the variable gsl_error_handler in
error.c. This makes the usage of the function gsl_set_error_handler_off()
in error.c unpredictable, since its result will depend on which of the Perl
generated .dll modules are called.

I believe configure.ac needs to be updated here. See line 167:

case $host in
  *-*-cygwin* | *-*-mingw* )
  if test "$enable_shared" = yes; then
    GSLCBLAS_LDFLAGS="$GSLCBLAS_LDFLAGS -no-undefined"
    GSL_LDFLAGS="$GSL_LDFLAGS -no-undefined"
    GSL_LIBADD="cblas/libgslcblas.la"
  fi
  ;;
esac


by adding "msys" at line 168, it is possible to create a
libgsl.dll.a import library that will refer to a .dll shared library. If I
change line 168 to:

  *-*-cygwin* | *-*-mingw*  | *-*-msys* )  # <-- add msys here

and rerun ./autogen.sh and then run

  ./configure --enable-shared --prefix=/opt/gsl/gsl-2.6; make; make install

it now produces an import libarary in /opt/gsl/gsl-2.6/lib/libgsl.dll.a and
a shared library in /opt/gsl/gsl-2.6/bin/msys-gsl-25.dll


reply via email to

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