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

Integer sizes and signals lost #313

Closed
cdsousa opened this issue Jul 17, 2021 · 1 comment
Closed

Integer sizes and signals lost #313

cdsousa opened this issue Jul 17, 2021 · 1 comment

Comments

@cdsousa
Copy link

cdsousa commented Jul 17, 2021

With a default configuration this

struct A
{
    int16_t x;
    int16_t y;
    uint32_t z;
};

void f(int16_t x);

gets translate to this

struct A
    x::Cint
    y::Cint
    z::Cint
end

function f(x)
    @ccall libclang.f(x::Cint)::Cvoid
end

Looking into https://github.com/JuliaInterop/Clang.jl/blob/master/src/generator/definitions.jl I'd suppose that these integers would be well translated. (I couldn't find any option related to this too.)

@Gnimuc
Copy link
Member

Gnimuc commented Jul 17, 2021

Cint is a flag that means clang failed to parse your source code. When parsing code with Clang.jl, one needs to treat it as a real clang compiler, so all of those compiler flags should be passed correctly.

int16_t and uint32_t are defined in stdint.h, so you should add #include <stdint.h> to your code.

Maybe I should add this info to FAQ.

BTW, https://github.com/JuliaInterop/Clang.jl/blob/master/src/generator/definitions.jl these definitions are for force-translating int16_t to Int16 instead of const int16_t = __some_compiler_defined_types.

@cdsousa cdsousa closed this as completed Jul 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants