Open hros opened 1 year ago
In general it is not possible without writing a very large amount of code. But some of the more trivial conversions (e.g. numerical constants) are attempted by CBinding.
julia> module Macros
using CBinding
c``
c"""
#define NUMBER 1234
"""j
end
Main.Macros
julia> Macros.@NUMBER
1234
fantastic. It is working for me.
Edit: actually, it is working only for some macro constants. in my project (see link below), XXH3_SECRET_SIZE_MIN
is recognized but XXH_SECRET_DEFAULT_SIZE
is not.
One more thing, if you could have a look at the xxh project (referenced in a previous issue):
I am trying to wrap one last function, and for some reason it is not being exposed by CBinding.
The function is XXH3_generateSecret
(and its variant: XXH3_generateSecret_fromSeed
).
The function prototype looks like the other functions which are detected and exported by CBinding.
Naturally, I can create a custom wrapper for the function, but it would be a shame to load the library with Libdl just for this function
Related: using the cling
interpreter to resolve #define
values... https://github.com/JuliaInterop/Clang.jl/issues/309#issuecomment-1321300707
Cling is now available as a jll: https://github.com/JuliaBinaryWrappers/Cling_jll.jl Currently working on Linux and on intel macOS. Detail here: https://github.com/JuliaPackaging/Yggdrasil/blob/master/C/Cling/build_tarballs.jl#L102-L117
is it possible to import
#define NAME val
from a C header file to Julia such thatNAME = val
?