-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C library for Pkl #1026
Draft
KushalP
wants to merge
15
commits into
apple:main
Choose a base branch
from
KushalP:c-library-for-pkl
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
C library for Pkl #1026
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80a0c54
to
3e26bbb
Compare
The `assembleNative` target builds out a shared library for each of the OS/Arch variants we need.
Make sure that `graal_isolate.h` and `graal_isolate_dynamic.h` are tracked as output files. Extension adjustment -------------------- `native-image` will add an extension to the filename provided `-o`. We need to make sure that we track this correctly for each OS, and remove the extension when we provide it to `native-image`.
This change results in an architecture and OS-specific directory being created which now produces the headers for our shared library functions: ``` ❯ ll libpkl/build/libs/macos-aarch64/ graal_isolate_dynamic.h graal_isolate.h libpkl-macos-aarch64_dynamic.h libpkl-macos-aarch64.dylib libpkl-macos-aarch64.h ```
Has a default value with `convention` on `init { ... }`.
`NativeInputStream` lets our encoder/decoder use the correct implementation within MsgPack.
…ption` This is to deal with the following error: ``` Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a started Thread in the image heap. Thread name: main. Threads running in the image generator are no longer running at image runtime. If these objects should not be stored in the image heap, you can use '--trace-object-instantiation=java.lang.Thread' ```
As a demonstration of how to build a shared library together with our `native-image` shared library, use the following locally: ``` ❯ gradle :libpkl:assembleNative ❯ clang -v -shared \ -o libpkl.dylib \ libpkl/src/main/c/libpkl.c \ -Ilibpkl/src/main/c \ -Ilibpkl/build/libs/macos-aarch64 \ -Llibpkl/build/libs/macos-aarch64 \ -lpkl-macos-aarch64 ```
This is close to a demo of what this could look like.
56c8534
to
1226e49
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This introduces native C bindings for Pkl.
Follows SPICE-0015