Definitions of function pointer types should appear before their first use
marcom opened this issue · 4 comments
Clang.jl 0.17.0 makes nice type definitions for function pointers instead of Ptr{Cvoid}
, which is much appreciated.
These definitions in the generated julia code can appear after their first use in e.g. a struct, causing an error in julia when trying to use the generated wrapper.
Example:
https://github.com/marcom/ViennaRNA.jl
in the gen/
directory, bump Clang.jl compat to 0.17 and julia compat to 1.7 and run
julia --project generator.jl
The generated bindings cannot be loaded anymore:
ERROR: LoadError: UndefVarError: vrna_callback_hc_evaluate not defined
#408 is wrong. The original behavior is right.
It looks like the author got confused with a typedef-ed function pointer and a typedef-ed function prototype.
There is another way to fix what #408 is supposed to solve. Sorry, I should have read JuliaParallel/MPI.jl#688 more carefully.
cc @t-bltg
Hum sorry about this. Let me have a second look a it.
MPI.jl is a bit more problematic, I will try to submit a PR there after fixing Clang.jl.
Many thanks for the quick fix