Commit 64e24a34 authored by Laurent Belcour's avatar Laurent Belcour

Correction of the dynamic cast failure under OSX. This required to add a...

Correction of the dynamic cast failure under OSX. This required to add a -fvisilibity=hidden to avoid having vtables exported to every shared library.
parent d8c37a9a
import os
import sys
Import('env')
env = env.Clone()
......@@ -18,4 +19,12 @@ if(os.name == 'posix'):
libs = ['rt', 'dl']
#end
env.StaticLibrary('../build/core', sources, LIBS=libs, LINKFLAGS=['-shared'])
## Known compilation issue. If the core is not compiled with -fvisibility-hidden
## on OSX, the shared libraries and the softwares cannot share vtables. This
## impact the use of dynamic_cast in shared libraries.
##
if sys.platform == 'darwin':
env.AppendUnique(CCFLAGS = ['-fvisibility=hidden'])
#end
env.StaticLibrary('../build/core', sources, LIBS=libs)
......@@ -42,8 +42,9 @@ template<typename T> T open_library(const std::string& filename, const char* fun
return NULL;
}
#else
void* handle = dlopen(filename.c_str(), RTLD_LAZY);
if(handle != NULL)
void* handle = dlopen(filename.c_str(), RTLD_GLOBAL | RTLD_LAZY);
if(handle != NULL)
{
void (*res)();
*(void **)(&res) = dlsym(handle, function);
......
......@@ -3,4 +3,5 @@ env = env.Clone()
sources = ['rational_fitter.cpp']
libs = ['core']
env.SharedLibrary('../../build/rational_fitter_eigen', sources, LIBS=libs, LINKFLAGS=['-shared'])
env.SharedLibrary('../../build/rational_fitter_eigen', sources, LIBS=libs)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment