diff --git a/samples/python_extension/README.md b/samples/python_extension/README.md index e40df0d16ed..cd6ced6d626 100644 --- a/samples/python_extension/README.md +++ b/samples/python_extension/README.md @@ -7,6 +7,11 @@ lands. To build and run the sample do the following: +* Install Python with development headers, i.e. + ``` + sudo apt install python-dev + ``` + * Run `build.sh`, it will ask for superuser password to install Python extension * On macOS copy Kotlin binary to extension's directory and change install name with `install_name_tool` tool, i.e. @@ -15,6 +20,15 @@ To build and run the sample do the following: sudo install_name_tool /Library/Python/2.7/site-packages/kotlin_bridge.so \ -change libserver.dylib @loader_path/libserver.dylib ``` +* On Linux copy Kotlin binary in some place where libraries could be loaded from, i.e. + ``` + cp libserver.so /usr/local/lib/ + ldconfig + ``` + or modify dynamic loader search path with + ``` + export LD_LIBRARY_PATH=`pwd` + ``` * run Python code using Kotlin functionality with ``` diff --git a/samples/python_extension/src/main/c/kotlin_bridge.c b/samples/python_extension/src/main/c/kotlin_bridge.c index b9648a3255c..0843b758b90 100644 --- a/samples/python_extension/src/main/c/kotlin_bridge.c +++ b/samples/python_extension/src/main/c/kotlin_bridge.c @@ -23,9 +23,9 @@ // Note, that as we cache this in the global, and Kotlin/Native object references // are currently thread local, we make this global a TLS variable. -__thread static server_kref_demo_Server server = { 0 }; +static __thread server_kref_demo_Server server = { 0 }; -static T_(Server) getServer() { +static T_(Server) getServer(void) { if (!server.pinned) { server = __ kotlin.demo.Server.Server("the server"); }