Hi Araq, thanks for your quick reply, the .bycopy pragma worked! Now I have two
questions:
Am I using c2nim wrong? You suggested that c2nim would add the bycopy pragma,
but c2nim generates this:
type
MyStruct* = object
id*: cuint
width*: cint
height*: cint
mipmaps*: cint
format*: cint
The other question is that if I change width/height to floats, the output is
wrong again:
struct_test.nim:
type
MyStruct* {.bycopy.} = object
id*: cuint
width*: cfloat
height*: cfloat
mipmaps*: cint
format*: cint
#*rest of file*
struct_test.c:
typedef struct MyStruct {
unsigned int id;
float width;
float height;
int mipmaps;
int format;
} MyStruct;
output:
from nim: testStruct.width 2.0
from nim: testStruct.height 3.0
from c: testStruct.width 1473414672
from c: testStruct.height 1473414672