CGAL / cgal-swig-bindings

CGAL bindings using SWIG
Other
343 stars 93 forks source link

Problem with -fvisibity=hidden if CGAL_DIR was compiled header-only #109

Open lrineau opened 5 years ago

lrineau commented 5 years ago

On Linux, with CGAL_DIR is header-only, then all user-code is compiled with -DCGAL_HEADER_ONLY=1. Then, <CGAL/export/helpers.h>, one can read:

#if defined(CGAL_HEADER_ONLY) && ! defined(CGAL_USE_Qt5_RESOURCES)
#  define CGAL_DLL_IMPORT
#  define CGAL_DLL_EXPORT
#  define CGAL_DLL_LOCAL

That means that the macros CGAL_DLL_IMPORT and CGAL_DLL_EXPORT both evaluates to empty.

And then, if -fvisibility=hidden is used to compile the bindings, that does not work: python, for example, cannot initialize the CGAL modules.

I create this issue to remember it. The workaround is easy: do not use header-only. The long-term fix would be to duplicate the logic of the non-documented header <CGAL/export/helpers.h> into cgal-swig-bindings.

lrineau commented 5 years ago

Cc: @maxGimeno