JuliaInterop / Clang.jl

C binding generator and Julia interface to libclang
https://juliainterop.github.io/Clang.jl/
MIT License
219 stars 68 forks source link

Support hint sizes of arrays #444

Closed zaikunzhang closed 10 months ago

zaikunzhang commented 11 months ago

Dear Clang.jl maintainers,

First of all, thank you very much for this wonderful package!

This issue is motivated by the following discussion:

https://github.com/JuliaInterop/Clang.jl/discussions/443

It might be desirable to support double A[m*n], which is already supported by Clang, and is informative and user-friendly.

In PRIMA, such expressions are used in the public header prima.h. We will remove them for the moment in order to user Clang.jl. However, we do hope to restore them in the future when Clang.jl supports. See https://github.com/libprima/prima/pull/76.

Thanks.

Zaikun

Gnimuc commented 11 months ago

I just added a quick fix in #445. General rules for variable arrays are added, so variable arrays in the function prototype should work now. However, it's not trivial to map a C struct with variable arrays to a Julia type, which means #445 may introduce other bugs...

Gnimuc commented 11 months ago

In fact, variable array structs are rarely used in a public C header, so I guess maybe it's OK to merge that PR.

zaikunzhang commented 11 months ago

Thank you @Gnimuc very much for your swift response. No hurry. We can just remove the sizes for the moment while waiting for a solid implementation.