diff --git a/meson.build b/meson.build index 30c82d4..57d8f5b 100644 --- a/meson.build +++ b/meson.build @@ -6,7 +6,7 @@ project( default_options: [ 'buildtype=release', 'libdir=lib', - 'default_library=static', + 'default_library=shared', 'warning_level=0', ], ) diff --git a/src/tools/cutest_delegate.f90 b/src/tools/cutest_delegate.f90 index 3d7285c..e0b583b 100644 --- a/src/tools/cutest_delegate.f90 +++ b/src/tools/cutest_delegate.f90 @@ -19,11 +19,11 @@ #endif #ifdef _WIN32 -#define DLOPEN_BIND_NAME LoadLibrary -#define DLSYM_BIND_NAME GetProcAddress +#define DLOPEN_BIND_NAME "LoadLibrary" +#define DLSYM_BIND_NAME "GetProcAddress" #else -#define DLOPEN_BIND_NAME dlopen -#define DLSYM_BIND_NAME dlsym +#define DLOPEN_BIND_NAME "dlopen" +#define DLSYM_BIND_NAME "dlsym" #endif module cutest_delegate_r @@ -32,22 +32,22 @@ module cutest_delegate_r ! Interface for dlopen / LoadLibrary interface - function cutest_dlopen(name, mode) bind(C, name=DLOPEN_BIND_NAME) + function dlopen(name, mode) bind(C, name=DLOPEN_BIND_NAME) use iso_c_binding, only: c_ptr, c_int, c_char type(c_ptr) :: dlopen character(kind=c_char), dimension(*) :: name integer(kind=c_int) :: mode - end function cutest_dlopen + end function dlopen end interface ! Interface for dlsym / GetProcAddress interface - function cutest_dlsym(handle, symbol) bind(C, name=DLSYM_BIND_NAME) + function dlsym(handle, symbol) bind(C, name=DLSYM_BIND_NAME) use iso_c_binding, only: c_funptr, c_ptr, c_char type(c_funptr) :: dlsym type(c_ptr), value :: handle character(kind=c_char), dimension(*) :: symbol - end function cutest_dlsym + end function dlsym end interface ! Constantes pour les modes d'ouverture de bibliothèques @@ -73,15 +73,15 @@ subroutine load_routines(libname) bind(C, name=LOAD_ROUTINE_NAME) character(kind=c_char), dimension(*), intent(in) :: libname ! Charge la bibliothèque dynamique - lib_handle = cutest_dlopen(libname, RTLD_LAZY) + lib_handle = dlopen(libname, RTLD_LAZY) if (.not. c_associated(lib_handle)) then stop "Unable to load library" end if ! Récupère les adresses des fonctions - ptr_elfun = cutest_dlsym(lib_handle, ELFUN_BIND_NAME//c_null_char) - ptr_group = cutest_dlsym(lib_handle, GROUP_BIND_NAME//c_null_char) - ptr_range = cutest_dlsym(lib_handle, RANGE_BIND_NAME//c_null_char) + ptr_elfun = dlsym(lib_handle, ELFUN_BIND_NAME//c_null_char) + ptr_group = dlsym(lib_handle, GROUP_BIND_NAME//c_null_char) + ptr_range = dlsym(lib_handle, RANGE_BIND_NAME//c_null_char) ! Associe les pointeurs de procédure Fortran avec les adresses obtenues call c_f_procpointer(ptr_elfun, fun_elfun)