Skip to content

patches for DLM / LINKIMAGE support #2060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,14 @@ if(PYTHON_MODULE) #GDL.so
SET_TARGET_PROPERTIES(gdl PROPERTIES NO_SONAME TRUE)
SET_TARGET_PROPERTIES(gdl PROPERTIES SUFFIX ".so") # e.g. Mac defaults to .dylib which is not looked for by Python
else(PYTHON_MODULE) #GDL.so
## should permit gdl (exe) to export its symbols, necessary for linkimage and DLM
## BUT DOES NOT WORK LIKE THAT!!
## set (CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS true)
set(SOURCES ${SOURCES} gdl.cpp)
add_executable(gdl ${SOURCES})
## use this in conjunction with -fvisibility=hidden below, but complicated to make work.
# set_target_properties(gdl PROPERTIES CXX_VISIBILITY_PRESET hidden)
# set_target_properties(gdl PROPERTIES C_VISIBILITY_PRESET hidden)
endif(PYTHON_MODULE)

if(USE_OPENMP)
Expand Down Expand Up @@ -279,7 +285,7 @@ endif(PYTHON_MODULE)


if (NOT APPLE AND NOT OSX AND NOT MINGW)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-dynamic")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-dynamic") # -fvisibility=hidden
endif()
if (APPLE OR OSX )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fvisibility=protected") #-exported_symbols_list ${EXPORTED_SYMBOLS_LIST}")
Expand Down
2 changes: 1 addition & 1 deletion src/basic_pro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2008,7 +2008,7 @@ static DWORD launch_cmd(BOOL hide, BOOL nowait,
if (nParam > 2 && pipe(cerrP) == -1) e->Throw("GDL internal error: no more PIPE resources. ");
if (stderrKeyword && !RedirectedCoutToCerr && !RedirectedCerrToCout) cmd+=" 2>&1";

pid_t pid = vfork(); // *** fork
pid_t pid = fork(); // *** fork
if (pid == -1) // error in fork
{
close(cinP[0]);
Expand Down
15 changes: 4 additions & 11 deletions src/basic_pro_jmg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,7 @@ void CleanupProc( DLibPro* proc ) {
msg = "Couldn't open " + fn;
}
#else
#if defined(__APPLE__)
handle = dlopen(fn.c_str(), RTLD_NOW | RTLD_LOCAL); //DEEPBIND not on OSX ?
#else
handle = dlopen(fn.c_str(), RTLD_NOW | RTLD_LOCAL |RTLD_DEEPBIND);
#endif
handle = dlopen(fn.c_str(), RTLD_LAZY);
if( !handle ) {
msg = "Couldn't open " + fn;
char* error = dlerror();
Expand Down Expand Up @@ -378,7 +374,7 @@ void CleanupProc( DLibPro* proc ) {
// this method of 'cleaning' is excellent but show a problem when exiting, seen only with valgrind.
// Not clear why, as calling .FULL_RESET prior exiting does not show this error.
all_procs[proc_name].reset(
new DLibPro( (void (*)(EnvT* e)) (increment++), (void*)CallDllPro, MakeTarget( lib_symbol, proc_name ), proc_name.c_str(), max_args, min_args, has_keys),
new DLibPro( (void (*)(EnvT* e)) (increment++), (void*)CallDllPro, MakeTarget( lib_symbol, proc_name ), proc_name, max_args, min_args, has_keys),
CleanupProc
);
my_procs.insert(proc_name);
Expand All @@ -397,7 +393,7 @@ void CleanupProc( DLibPro* proc ) {
if( all_funcs.count( func_name ) ) return;
// this method of 'cleaning' is excellent but show a problem when exiting, seen only with valgrind.
all_funcs[func_name].reset(
new DLibFun((BaseGDL* (*)(EnvT* e)) (increment++), (void*)CallDllFunc , MakeTarget( lib_symbol, func_name ), func_name.c_str(), max_args, min_args, has_keys),
new DLibFun((BaseGDL* (*)(EnvT* e)) (increment++), (void*)CallDllFunc , MakeTarget( lib_symbol, func_name ), func_name, max_args, min_args, has_keys),
CleanupFunc
);
my_funcs.insert(func_name);
Expand Down Expand Up @@ -1140,10 +1136,7 @@ void CleanupProc( DLibPro* proc ) {
HMODULE handle = LoadLibraryW(wchr);
delete(wchr);
#else
// note following code line is correct for gcc and linux.
// in case of trouble on some architecture, find the correct option and make an #ifdef.
// Do *not* modify the following line. GD.
void* handle = dlopen(image.c_str(), RTLD_NOW | RTLD_GLOBAL);
void* handle = dlopen(image.c_str(), RTLD_LAZY);
#endif
if (handle == NULL) {
#if !defined(_WIN32) || defined(__CYGWIN__)
Expand Down
2 changes: 1 addition & 1 deletion src/dlm/brent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2674,7 +2674,7 @@ namespace lib {
}

//Note: this brent is not from gsl
extern "C" void brent(EnvT* e) {
void brent(EnvT* e) {
// sanity check (for number of parameters)
SizeT nParam = e->NParam();
if (nParam != 5) e->Throw("Incorrect number of arguments.");
Expand Down
Loading
Loading