mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
...
This commit is contained in:
parent
e6c5ace927
commit
1b978b5d01
@ -16,11 +16,6 @@ int main(int argc, char** argv){
|
|||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
void* p = dlopen("libpocketpy.dylib", RTLD_NOW | RTLD_GLOBAL);
|
void* p = dlopen("libpocketpy.dylib", RTLD_NOW | RTLD_GLOBAL);
|
||||||
#endif
|
#endif
|
||||||
if(p == nullptr){
|
|
||||||
std::cerr << "unable to load dynamic library" << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
pkpy::VM* vm = pkpy_new_vm();
|
pkpy::VM* vm = pkpy_new_vm();
|
||||||
pkpy::_bind(vm, vm->builtins, "input() -> str", &f_input);
|
pkpy::_bind(vm, vm->builtins, "input() -> str", &f_input);
|
||||||
|
|
||||||
|
19
tests/dylib/CMakeLists.txt
Normal file
19
tests/dylib/CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.17)
|
||||||
|
|
||||||
|
project(test)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/../../include
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(
|
||||||
|
${PROJECT_NAME}
|
||||||
|
SHARED
|
||||||
|
test.cpp
|
||||||
|
)
|
@ -1 +0,0 @@
|
|||||||
clang++ -std=c++17 -fno-rtti -O2 -stdlib=libc++ -Wfatal-errors -o libtest.so test.cpp -I../../include -fPIC -shared
|
|
@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
print(os.getcwd())
|
print(os.getcwd())
|
||||||
test = __import__('libtest.so')
|
test = __import__('build/libtest.so')
|
||||||
|
|
||||||
test.hello()
|
test.hello()
|
Loading…
x
Reference in New Issue
Block a user