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

set_const likes to create references #374

Open
eschnett opened this issue Sep 8, 2023 · 1 comment
Open

set_const likes to create references #374

eschnett opened this issue Sep 8, 2023 · 1 comment

Comments

@eschnett
Copy link

eschnett commented Sep 8, 2023

I was using set_const to define enum values. This code works fine (CHAR is an enum constant):

        mod.set_const("CHAR", CHAR);

This code, however, leads to problems and crashes while precompiling:

        const Datatype dt = CHAR;
        mod.set_const("CHAR", dt);

It seems that this creates something that is a CxxReference{Datatype} on the Julia side, and which internally holds a pointer.

Is that behaviour ever useful? If not, should set_const automatically remove references etc.?

@barche
Copy link
Collaborator

barche commented Sep 13, 2023

Confirmed, until I can find a more elegant fix, you can work around this using:

mod.set_const("CHAR", static_cast<Datatype>(dt));

barche added a commit to JuliaInterop/libcxxwrap-julia that referenced this issue Sep 26, 2023
barche added a commit to JuliaInterop/libcxxwrap-julia that referenced this issue Nov 16, 2023
barche added a commit to JuliaInterop/libcxxwrap-julia that referenced this issue Nov 16, 2023
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