-
Notifications
You must be signed in to change notification settings - Fork 68
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
Various non-valid Julia code output #382
Comments
I got the following errors when running the generator script:
It appears that After looking into the source code a bit, it turns out that For example, some C APIs provide a macro for including all needed headers, and users need to always add this macro before including any headers in their source file. However, in Clang.jl, each input header in |
Thanks, for the input. I actually don't see those errors ([email protected] with Julia 1.7.2). However, it looks like I don't need that header explicitly anyway. Regarding the overflow of Int32, that seems to come from typedef int MPI_Datatype;
#define MPI_FLOAT_INT ((MPI_Datatype)0x8c000000) which Clang.jl translates to const MPI_Datatype = Cint
const MPI_FLOAT_INT = MPI_Datatype(0x8c000000) but shouldn't it be const MPI_FLOAT_INT = 0x8c000000 % MPI_Datatype instead? |
For this case, as there is no rule to one-to-one map a C-style cast to Julia, the result needs to be patched manually. You could ignore that macro and put the right version in |
Okay thanks. A couple of other things from #define MPI_T_ENUM_NULL ((MPI_T_enum)NULL) becomes const MPI_T_ENUM_NULL = MPI_T_enum(NULL) which should be #define MPI_ARGV_NULL (char **)0 becomes const MPI_ARGV_NULL = (Cchar * (*))(0) which Julia doesn't even parse. Should be |
I'm not sure, you probably need to check that library to see what an
This is indeed a failure case of the current assumption used in Clang.jl. For all of those macro issues, I recommend adding them to the macro ignore list and then manually patching them in prologue.jl. |
Okay thanks! |
I'd like to keep this open for tracking those failing cases. |
I have another one:
leads to:
|
I recently used Clang.jl to generate bindings for HYPRE: (https://github.com/fredrikekre/HYPRE.jl). I had to add some things to the ignore list, where Clang.jl generated invalid Julia code, see: https://github.com/fredrikekre/HYPRE.jl/blob/373b9d7d5183bf8ddfa05af68d2ff00b5d98cc28/gen/generator.toml#L6-L27
Perhaps these are known issues, and if so please close, but thought I should atleast report it.
The text was updated successfully, but these errors were encountered: