The way you asked your question (hint: vague, general, not clear what you 
really want) Araq responded perfectly correctly.

Now you ask us to read a 150 lines file and we are supposed to find out what 
you want and what your problem is by reading through and make sense of your 
code.. Chances for that to happen are slim I guess.

Maybe helpful: Sometimes C stuff wants/needs some structs and stuff allocated 
by a caller. In such cases it's often better to do those allocations in C and 
to pass them to Nim in a way where the Nim code doesn't need to know anything 
about them (other than that they are pointers of some kind). As long as the Nim 
code doesn't need to do anything with those pointers (other than passing them 
around) you need _not_ be precise; you can, for instance, tell Nim that some 
pointer to some <complicated C structure> is simply a char pointer.

Another maybe helpful hint is to "allocate" _simple stuff_ (like say a C char 
array) in Nim (by simply having a var) and to pass the pointer to it (more 
precisely usually a pointer to its data) via myvar.addr() to a C function. Do 
**not** allocate a bit here (Nim) and bit there (C) but try to be consistent.

For a more specific answer you need to provide a more specific problem 
description. 

Reply via email to