Re: Calling functions written in C returns wrong results
#calculator.nim file {.compile: "logic.c".} proc addTwoIntegers(a, b: cint): cint {.importc.} when isMainModule: echo addTwoIntegers(3, 7) * * * #logic.c file int addTwoIntegers(int a, int b) { return a + b; }
Calling functions written in C returns wrong results
I was trying to replicate the "C invocation example" on this url "[https://nim-lang.org/docs/backends.html;](https://nim-lang.org/docs/backends.html), i'm doing it on windows with my nim version being 1.0, it basically binds a C module with a function that adds up two numbers, and the thing is i'm getting the same wrong result over and over again, when adding 7 and 3 i get 6487644, i'm not quite familiar with C to be honest, and cant find why this happens, i would apreciate your help.
Lambdas?
i don't seem to find any documentation on lambdas, so far i'm enjoying programming in nim, but i would love to try those multi-line lambdas that nim says it features, so... how do i use 'em?