That makes sense.
It is generally a bad idea to send the whole seq to C function because there
may reside additional data like seq length at start of memory chunk. Try to use
address of first element of the sequence instead.
Thanks again cdome.
I have another question with C but I want to avoid polluting the homepage with
noobish topics. And strings are kind of sequence isn't it ?
I want to pass a sequence to a C function but the result is unexpected.
Two files for minimal example.
proc print_array(t
Correct:
proc print_string*(input_string: cstring, size: cint) {.header:
"cfunction.h", importc:"print_string".}
Hi I imported a c function who take a char array as argument. I pass a Nim
string to it but the 3 first characters aren't expected, like this one "|" and
random special chars who can't be displayed by the forum.
Code example
import streams
#import the c function.
proc