Lately, I’ve managed to pass a BigInt to C and back (Passing GMP variables from C(++) to Julia - #10 by Questioner). Now suppose I want to generate Fibonacci numbers in C and pass them to Julia. I thought I just take the analogous code for arrays
#include<gmp.h>
void test(mpz_t* var[]) {
mpz_init_set_ui(*var[1], 2);
}
but upon calling it
@ccall "./art.so".test(x::Ptr{Ref{BigInt}})::Cvoid
where x was
x
2-element Vector{Ref{BigInt}}:
Base.RefValue{BigInt}(3)
Base.RefValue{BigInt}(3)
it ran, but crashed upon typing “x” and hitting enter, producing a lengthy error message.
I’d be grateful for any input on how to solve this problem.