-
Notifications
You must be signed in to change notification settings - Fork 521
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
Feasibility of std::array with Set #587
Comments
Hi @gyuro
In C, you would have to use
I don't know how is |
@inumanag, thanks for the comments. Based on my observations, declaring a tuple value and passing it by pointer to a C function works fine, as shown below, even though Codon lacks C++ interop: foo = (1, 2)
print_values(__ptr__(foo), 3, 4) However, my question is about how to pass an array or any container by value to a C function on the Codon side, like this: foo = (1, 2)
print_values(foo, 3, 4) |
In a nutshell, you cannot---you would need to mock up Codon's type internal structure in C (can be done but is not supported nor recommended). The best way is to cast everything to lists and then pass list pointers with sizes. |
I'm trying to call the
print_values
function in Codon, but the value ofa
is printed as zero, whileb
is 3 andc
is 4.In C:
In Codon:
This happened with
const double[2] a
. Could you help me find a solution?The text was updated successfully, but these errors were encountered: