-
Notifications
You must be signed in to change notification settings - Fork 10
LibZstd Clang.jl generated bindings #29
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d076afa
Initial attempt at Clang generated API calls
mkitti 47753a9
Generate zstd_api with ZSTD_STATIC_LINKING_ONLY
mkitti 9416204
Add patch versus generated output
mkitti 702a164
Amend gitignore
mkitti 397c6fc
Change module name from Lib to LibZstd
mkitti bd3469a
Use Clang 0.14 generation
mkitti 6976631
Remove empty lines
mkitti a81136e
Add patch for mutable buffer structs
mkitti c084472
Tidy up commented out code
mkitti e52b2c2
Use rewrite! mechanism rather than patch
mkitti ca42fe4
Add Project.toml, Manifest.toml, directions
mkitti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,5 @@ | |
| /deps/build.log | ||
| /deps/deps.jl | ||
| /deps/usr/ | ||
| src/libzstd/LibTemplate.jl | ||
| src/libzstd/ctypes.jl | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do NOT do these object to pointer conversions manually. Leave it to ccall to do it. I’m assuming clang isn’t generating a signature that requires you to do such conversion manually. If that’s not the case then the code it generate is broken and must be fixed. ( a brief look suggests that the generated wrappers are correct)
same with all uses of pointer_from_objref here.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I just realized that the alignment of the diff made me think that the change is new to this pr but it’s actually not….
I that case it should still be fixed but doesn’t have to be done here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unclear what you are suggesting here.
LibZstd.ZSTD_initDStreamnow callsccall. All I'm doing with the change above is consolidating all theccallreferences into theLibZstdmodule.CodecZstd.jl/src/libzstd/LibZstd.jl
Lines 307 to 309 in c084472
Perhaps you mean that I should just pass
dstreamdirectly rather thandstream.ptror something like that?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the change you made is fine. But both the new and the old version should have the Julia object (dsteam in this case) directly passed to ccall. You’ll need to define the correct unsafe convert to make it work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean. This probably has some garbage collection implications as well now that I think about it.
I think I might want to save those changes for another PR and perhaps another release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason it’s broken is indeed because of object lifetime.