I want to make a arbitary-integer arithmetic c library with c code generated
from Nim. And I want to make a tuple in Nim to store it like:
tuple
isNotNeg : bool
num_seq : seq[cuint]
Run
And it's the example function:
proc example() : HugeNum {.exportc.} =
var s : HugeNum
s = (isNotNeg : true, num_seq : @[32'u32 , 12'u32])
return s
Run
However, when I generated to C header file with nim c --noMain --noLinking
--header:xxx.h xxx.nim , the definition of getting a bignum function in the C
header file is like:
N_NIMCALL(void, example)(HugeNum* Result);
Run
It says it should take a HugeNum pointer, however the function is non-parameter
function.
The function returning only a sequence didn't have the event. Therefore,
proc get_seq2() : seq[cuint] {.exportc.} =
var s : seq[cuint] = @[9'u32]
return s
Run
becomes
N_NIMCALL(tySequence__U48dCdy0noze9bNL2psZZGA*, get_seq2)(void); // takes
no argument
Run