Skip to content
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

Definitions of function pointer types should appear before their first use #410

Closed
marcom opened this issue Dec 18, 2022 · 4 comments · Fixed by #411
Closed

Definitions of function pointer types should appear before their first use #410

marcom opened this issue Dec 18, 2022 · 4 comments · Fixed by #411
Labels

Comments

@marcom
Copy link

marcom commented Dec 18, 2022

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
@Gnimuc Gnimuc added the bug label Dec 19, 2022
@Gnimuc
Copy link
Member

Gnimuc commented Dec 19, 2022

#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

@t-bltg
Copy link
Contributor

t-bltg commented Dec 19, 2022

Hum sorry about this. Let me have a second look a it.

@Gnimuc
Copy link
Member

Gnimuc commented Dec 19, 2022

MPI.jl is a bit more problematic, I will try to submit a PR there after fixing Clang.jl.

JuliaParallel/MPI.jl#694

@marcom
Copy link
Author

marcom commented Dec 20, 2022

Many thanks for the quick fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants