-
Notifications
You must be signed in to change notification settings - Fork 143
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
Clang.jl generated bindings #897
base: master
Are you sure you want to change the base?
Conversation
I created a prototype package at https://github.com/mkitti/LibHDF5.jl . Some manual edits needed to be made to the resulting generated module, but I hope to automate those shortly. |
While I really like the simplicity of the current binding generator, using Clang.jl is probably the right future direction. I'd like to spend time to understand how the Clang.jl works here, so I hope you're ok with this process taking longer than usual. |
Based on that feedback, what I will do is have the Clang.jl generator generate a version of api_defs.jl. We can copy and and paste methods lines from there and perhaps automate the addition of missing |
I now have a generator that generates For example, here is a new set of H5PL bindings: @bind h5pl_set_loading_state(plugin_control_mask::Cuint)::herr_t "Error in h5pl_set_loading_state (not annotated)"
@bind h5pl_get_loading_state(plugin_control_mask::Ptr{Cuint})::herr_t "Error in h5pl_get_loading_state (not annotated)"
@bind h5pl_append(search_path::Ptr{Cchar})::herr_t "Error in h5pl_append (not annotated)"
@bind h5pl_prepend(search_path::Ptr{Cchar})::herr_t "Error in h5pl_prepend (not annotated)"
@bind h5pl_replace(search_path::Ptr{Cchar}, index::Cuint)::herr_t "Error in h5pl_replace (not annotated)"
@bind h5pl_insert(search_path::Ptr{Cchar}, index::Cuint)::herr_t "Error in h5pl_insert (not annotated)"
@bind h5pl_remove(index::Cuint)::herr_t "Error in h5pl_remove (not annotated)"
@bind h5pl_get(index::Cuint, path_buf::Ptr{Cchar}, buf_size::Csize_t)::Cssize_t "Error in h5pl_get (not annotated)"
@bind h5pl_size(num_paths::Ptr{Cuint})::herr_t "Error in h5pl_size (not annotated)" |
Closing since we currently do not plan to merge this. However, many of the generated bindings from LibHDF5.jl have been integrated manually. https://github.com/mkitti/LibHDF5.jl/blob/main/src/bind.jl |
Going to leave this open since it probably makes sense to use this, just haven't gotten around to testing things out yet. |
Clang.jl is able to read C headers and automatically generate Julia bindings.
Following the instructions at https://juliainterop.github.io/Clang.jl/stable/ , I have generated a module
LibHDF5
.As-is, I believe this is useful since HDF5.jl does not cover the entire HDF5 API. Also, currently this generator does not mangle the names. They are the same as their C functions, which may help some to port code from C or other languages to Julia.
The Clang.jl generator is also customizable. It may be possible to combine this with the current generator for HDF5.jl in order to expand the
HDF5.API
module to cover the entire API.Questions