mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-25 05:50:17 +00:00
...
This commit is contained in:
parent
2742414fa7
commit
34cc526104
@ -69,7 +69,7 @@ else()
|
|||||||
target_link_libraries(main ${PROJECT_NAME})
|
target_link_libraries(main ${PROJECT_NAME})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# link math library
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
target_link_libraries(${PROJECT_NAME} m)
|
target_link_libraries(${PROJECT_NAME} m)
|
||||||
|
target_link_libraries(${PROJECT_NAME} dl)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -3,7 +3,8 @@
|
|||||||
#if PK_IS_DESKTOP_PLATFORM
|
#if PK_IS_DESKTOP_PLATFORM
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
void* LoadLibraryA(const char*);
|
||||||
|
void* GetProcAddress(void*, const char*);
|
||||||
#else
|
#else
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#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 {
|
int load_module_from_dll_desktop_only(const char* path) PY_RAISE PY_RETURN {
|
||||||
const char* f_init_name = "py_module_initialize";
|
const char* f_init_name = "py_module_initialize";
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HMODULE dll = LoadLibraryA(path);
|
void* dll = LoadLibraryA(path);
|
||||||
if(dll == NULL) return 0;
|
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
|
#else
|
||||||
void* dll = dlopen(path, RTLD_LAZY);
|
void* dll = dlopen(path, RTLD_LAZY);
|
||||||
if(dll == NULL) return 0;
|
if(dll == NULL) return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user