Hello, I'm currently exploring Nim's FFI capabilities. I went through the both Manual and Tutorial but did not manage to find a detailed explanation on how various Nim types are layed out in memory.
Here is what i do understand so far:
What I basically want to achieve is to create C and Nim type definitions which will have the same memory layout. Is it safe to assume the following type equality:
C Nim
double float64
int int
size_t int (with operations though unsigned module)
int bool
Another problem is the Nim's sequence memory layout. The typical C code for a sequence like type (assuming straightforward memory allocation strategy) would be:
struct arr {
size_t len;
int* elements;
};
Is there any way to map such a struct to a sequence, so it could be passed between Nim and C without copying data?