From 34cc526104bdf15496df87f5e226f5881779bd52 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Mon, 9 Sep 2024 13:47:14 +0800 Subject: [PATCH] ... --- CMakeLists.txt | 2 +- src/interpreter/dll.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c17d50f..eb63418c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,7 @@ else() target_link_libraries(main ${PROJECT_NAME}) endif() -# link math library if(UNIX) target_link_libraries(${PROJECT_NAME} m) + target_link_libraries(${PROJECT_NAME} dl) endif() diff --git a/src/interpreter/dll.c b/src/interpreter/dll.c index 2a4c7e86..c60b8ec2 100644 --- a/src/interpreter/dll.c +++ b/src/interpreter/dll.c @@ -3,7 +3,8 @@ #if PK_IS_DESKTOP_PLATFORM #ifdef _WIN32 -#include +void* LoadLibraryA(const char*); +void* GetProcAddress(void*, const char*); #else #include #endif @@ -13,9 +14,9 @@ typedef bool (*py_module_initialize_t)() PY_RAISE PY_RETURN; int load_module_from_dll_desktop_only(const char* path) PY_RAISE PY_RETURN { const char* f_init_name = "py_module_initialize"; #ifdef _WIN32 - HMODULE dll = LoadLibraryA(path); + void* dll = LoadLibraryA(path); if(dll == NULL) return 0; - py_module_initialize_t f_init = (py_module_initialize_t)GetProcAddress(dll, init_func); + py_module_initialize_t f_init = (py_module_initialize_t)GetProcAddress(dll, f_init_name); #else void* dll = dlopen(path, RTLD_LAZY); if(dll == NULL) return 0;