Fix various issues in libpkl (#1805)

* Fix possible SIGSEGV from host process.
   - Require that the same `pkl_exec_t` be used in the same OS thread; returning meaningful error if this fails
* Remove `System.exitProcess(1)` logic in NativeTransport; this would kill the host process too and isn't an appropriate action for a received ProtocolException
* Allow multiple calls to pkl_init without pkl_close; this limitation doesn't really make any sense
* Prefer calling methods defined in graal_isolate.h, instead of creating the same method via CEntryPoint
* Add a CMakeLists.txt so that CLion can follow the code and provide proper diagnostics
* Improve doc comments; describe params as either in or out
This commit is contained in:
Daniel Chao
2026-07-31 16:23:37 +00:00
committed by GitHub
parent 5333d55269
commit 417c08ae11
10 changed files with 169 additions and 188 deletions
+24
View File
@@ -0,0 +1,24 @@
# This file is only used to configure CLion with proper include paths.
# Pkl builds everything through Gradle, not CMake.
cmake_minimum_required(VERSION 4.2)
project(pkl C)
set(CMAKE_C_STANDARD 11)
file(GLOB NATIVE_LIB_INCLUDE_DIRS CONFIGURE_DEPENDS
libpkl/build/native-libs/*/include)
file(GLOB NATIVE_IMAGE_BUILD_DIRS CONFIGURE_DEPENDS
libpkl/build/tmp/native-image-build/*)
include_directories(${NATIVE_LIB_INCLUDE_DIRS})
include_directories(${NATIVE_IMAGE_BUILD_DIRS})
include_directories(libpkl/src/main/c/include)
file(GLOB_RECURSE GENERATED_HEADER_FILES CONFIGURE_DEPENDS
libpkl/build/tmp/native-libs/*/*.h)
add_executable(pkl
${GENERATED_HEADER_FILES}
libpkl/src/main/c/include/pkl.h
libpkl/src/main/c/pkl.c
libpkl/src/nativeTest/c/test_pkl.c)