I have some FFI code that interfaces with another library, and the target library has GNU multiprecision integers. Is it possible to create a BigInt directly from such a multiprecision integer pointer? The default constructor for BigInt is hidden, so I cannot construct a BigInt from limbs directly. julia/base/gmp.jl at 6d172b025e4befc4d274d9fbc9339917a8a86b65 · JuliaLang/julia · GitHub
mutable struct BigInt <: Signed
alloc::Cint
size::Cint
d::Ptr{Limb}
function BigInt(; nbits::Integer=0)
b = MPZ.init2!(new(), nbits)
finalizer(cglobal((:__gmpz_clear, libgmp)), b)
return b
end
end