mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
...
This commit is contained in:
parent
383a6d3194
commit
0e736b2f71
@ -81,7 +81,7 @@ with open("amalgamated/main.cpp", "wt", encoding='utf-8') as f:
|
|||||||
f.write(text)
|
f.write(text)
|
||||||
|
|
||||||
if sys.platform in ['linux', 'darwin']:
|
if sys.platform in ['linux', 'darwin']:
|
||||||
ok = os.system("clang++ -o pocketpy amalgamated/main.cpp --std=c++17 -stdlib=libc++")
|
ok = os.system("clang++ -o pocketpy amalgamated/main.cpp --std=c++17 -stdlib=libc++ -ldl")
|
||||||
if ok == 0:
|
if ok == 0:
|
||||||
print("Test build success!")
|
print("Test build success!")
|
||||||
os.remove("pocketpy")
|
os.remove("pocketpy")
|
||||||
|
@ -162,12 +162,13 @@ inline PyObject* const PY_OP_YIELD = (PyObject*)0b110011;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#elif __unix__
|
|
||||||
|
|
||||||
#include <dlfcn.h>
|
|
||||||
|
|
||||||
#elif __EMSCRIPTEN__
|
#elif __EMSCRIPTEN__
|
||||||
|
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
|
|
||||||
|
#elif __unix__
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -11,11 +11,18 @@ static dylib_entry_t load_dylib(const char* path){
|
|||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
auto p = std::filesystem::absolute(path, ec);
|
auto p = std::filesystem::absolute(path, ec);
|
||||||
if(ec) return nullptr;
|
if(ec) return nullptr;
|
||||||
HMODULE handle = LoadLibraryA(p.c_str());
|
HMODULE handle = LoadLibraryA((LPCSTR)p.c_str());
|
||||||
if(!handle) return nullptr;
|
if(!handle) return nullptr;
|
||||||
return (dylib_entry_t)GetProcAddress(handle, "platform_module__init__");
|
return (dylib_entry_t)GetProcAddress(handle, "platform_module__init__");
|
||||||
}
|
}
|
||||||
#else
|
#elif __EMSCRIPTEN__
|
||||||
|
|
||||||
|
static dylib_entry_t load_dylib(const char* path){
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif __unix__
|
||||||
|
|
||||||
static dylib_entry_t load_dylib(const char* path){
|
static dylib_entry_t load_dylib(const char* path){
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
auto p = std::filesystem::absolute(path, ec);
|
auto p = std::filesystem::absolute(path, ec);
|
||||||
@ -24,15 +31,14 @@ static dylib_entry_t load_dylib(const char* path){
|
|||||||
if(!handle) return nullptr;
|
if(!handle) return nullptr;
|
||||||
return (dylib_entry_t)dlsym(handle, "platform_module__init__");
|
return (dylib_entry_t)dlsym(handle, "platform_module__init__");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static dylib_entry_t load_dylib(const char* path){
|
static dylib_entry_t load_dylib(const char* path){
|
||||||
PK_UNUSED(path);
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void init_builtins(VM* _vm) {
|
void init_builtins(VM* _vm) {
|
||||||
#define BIND_NUM_ARITH_OPT(name, op) \
|
#define BIND_NUM_ARITH_OPT(name, op) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user