Use another language to call a function: Difference between revisions

Updated to work with Nim 1.4: replaced ".. <text.len" with ".. text.high". Changed compilation command for C.
(Add Rust implementation)
(Updated to work with Nim 1.4: replaced ".. <text.len" with ".. text.high". Changed compilation command for C.)
Line 1,028:
return 0
 
for i in 0 .. <text.lenhigh:
data[i] = text[i]
length = text.len
Line 1,053:
}
}</lang>
Compile the above with <code>gcc -ldl -o main main.c libquery.nim.a</code>, then execute the resulting <code>main</code> binary:
<pre>./main
Here am I
Anonymous user