Skip to content

Commit

Permalink
Merge pull request #72 from eisenhauer/DLL
Browse files Browse the repository at this point in the history
  • Loading branch information
eisenhauer authored Aug 15, 2023
2 parents e9be8e6 + af9cd71 commit 28bf57a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ if(EVPATH_TRANSPORT_MODULES)
foreach(M cmselect cmsockets cmudp cmmulticast)
set_target_properties(${M} PROPERTIES
OUTPUT_NAME ${EVPATH_LIBRARY_PREFIX}${M}
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${EVPATH_INSTALL_MODULE_DIR})
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${EVPATH_INSTALL_MODULE_DIR}
WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
install(TARGETS ${M} DESTINATION ${EVPATH_INSTALL_MODULE_DIR} COMPONENT ${EVPATH_MODULE_COMPONENT_PREFIX}${M})
endforeach()

Expand Down
4 changes: 4 additions & 0 deletions cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3773,7 +3773,11 @@ CM_init_select(CMControlList cl, CManager cm)
lt_dladdsearchdir(EVPATH_MODULE_BUILD_DIR);
lt_dladdsearchdir(EVPATH_MODULE_INSTALL_DIR);
libname = malloc(strlen("lib" CM_LIBRARY_PREFIX "cm") + strlen(select_module) + strlen(MODULE_EXT) + 1);
#ifndef HAVE_WINDOWS_H
strcpy(libname, "lib" CM_LIBRARY_PREFIX "cm");
#else
strcpy(libname, CM_LIBRARY_PREFIX "cm");
#endif
strcat(libname, select_module);
strcat(libname, MODULE_EXT);
handle = CMdlopen(cm->CMTrace_file, libname, 0);
Expand Down
4 changes: 4 additions & 0 deletions cm_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ load_transport(CManager cm, const char *trans_name, int quiet)
strlen(MODULE_EXT)
+ 1);

#ifndef HAVE_WINDOWS_H
strcpy(libname, "lib" CM_LIBRARY_PREFIX "cm");
#else
strcpy(libname, CM_LIBRARY_PREFIX "cm");
#endif
strcat(libname, trans_name);
strcat(libname, MODULE_EXT);

Expand Down
10 changes: 9 additions & 1 deletion dlloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,19 @@ CMdlsym(void *vdlh, char *sym)
return NULL;
#else
dlhandle dlh = (dlhandle)vdlh;
char *tmp = malloc(strlen(sym) + strlen(dlh->lib_prefix) + 1);
char *tmp = malloc(strlen(sym) + strlen(dlh->lib_prefix) + 3);
void *sym_val;
strcpy(tmp, dlh->lib_prefix);
strcat(tmp, sym);
sym_val = dlsym(dlh->dlopen_handle, tmp);
if (!sym_val) {
// try with lib prefix
char *tmp2 = malloc(strlen(tmp) + 4);
strcpy(tmp2, "lib");
strcat(tmp2, tmp);
sym_val = dlsym(dlh->dlopen_handle, tmp2);
free(tmp2);
}
free(tmp);
if (!sym_val)
sym_val = dlsym(dlh->dlopen_handle, sym);
Expand Down

0 comments on commit 28bf57a

Please sign in to comment.