> tried with nim cpp instead with nim c and it compiles,

I don't understand, `nim c` and then calling from C works for me (as it should).

> but whenever the function is called it drops segfault.

You need to initialize Nim's GC by calling `NimMain()` in C beforehand. Unless 
you use a dynamic lib with `--app:lib`.

> Also, why even with the --header flag Nim still produces object files?

It is supposed to only generate a header to include in your C file, use 
`--compileOnly` to skip object file generation. Alternatively you can generate 
a static lib with `--app:staticlib`.

Reply via email to