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

ERROR: LoadError: Unnamed struct member in: CLCursor (CLStructDecl) ... cursor: CLCursor (CLFieldDecl) #236

Closed
kdheepak opened this issue Sep 22, 2019 · 4 comments
Labels
C11 record struct/union/enum issues

Comments

@kdheepak
Copy link

I'm getting the following error when I run the example posted in the README.md with some header files that I'm trying to wrap.

┌ Error: error thrown. Last cursor available in context.cursor_stack.
└ @ Clang ~/.julia/packages/Clang/CiPzM/src/compat.jl:125
ERROR: LoadError: Unnamed struct member in: CLCursor (CLStructDecl)  ... cursor: CLCursor (CLFieldDecl)
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] wrap!(::DefaultContext, ::CLStructDecl) at /Users/USER/.julia/packages/Clang/CiPzM/src/wrap_c.jl:159
 [3] run(::WrapContext, ::Bool) at /Users/USER/.julia/packages/Clang/CiPzM/src/compat.jl:122
 [4] run(::WrapContext) at /Users/USER/.julia/packages/Clang/CiPzM/src/compat.jl:89
 [5] top-level scope at /Users/USER/GitRepos/TestPackage/generate.jl:17
 [6] include at ./boot.jl:328 [inlined]
 [7] include_relative(::Module, ::String) at ./loading.jl:1105
 [8] include(::Module, ::String) at ./Base.jl:31
 [9] exec_options(::Base.JLOptions) at ./client.jl:295
 [10] _start() at ./client.jl:468
in expression starting at /Users/USER/GitRepos/TestPackage/generate.jl:17
@Gnimuc
Copy link
Member

Gnimuc commented Sep 23, 2019

Looks like you got some anonymous struct members in your header file. Unfortunately, some C11 features like this one are not supported. See #233 for a workaround.

@Gnimuc Gnimuc added C11 record struct/union/enum issues labels Sep 23, 2019
@kdheepak
Copy link
Author

Thanks for the quick response! I have a very large set of header files, and since this failed, at the moment I'm just manually creating all the Julia structs I need. Is there a way to tell Clang.jl to skip the ones it can't parse and wrap/convert the remaining? That would get me far enough.

@Gnimuc
Copy link
Member

Gnimuc commented Sep 23, 2019

you can overload wrap!(ctx::AbstractContext, cursor::CLStructDecl) by copy-pasting the whole function and change this line to @warn "Unnamed struct member in: $cursor ... cursor: $field_cursor".

@kdheepak
Copy link
Author

Thanks! I'll try it out tomorrow. I'll close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C11 record struct/union/enum issues
Projects
None yet
Development

No branches or pull requests

2 participants