Thanks guys! Not sure what was happening the other day -- likely I wasn't
calling nimc right. I just tried @shirleyquirk's test and it ran fine. Nice!
Now back to my regularly schedule how can I abuse Nim. ;)
That's odd and might be a bug, as the docs specify:
> The compile pragma can be used to compile and link a C/C++ source file with
> the project
I've persoally used `{.compile.}` in the past and haven't had a problem, Nim
was building and linking the requested C files as requested.
maybe this is too naive a toy example, but it works:
`clib.c`
int sum(int a,int b){return a+b;}
Run
`nimlib.nim`
{.compile:"clib.c".}
#proc sum(a,b:int32):int32{.importc.}
## as @auxym says; if it's not static, it's exported
## even
> in the Nim object cache but don’t seem to be[..]linkedin
Maybe add `--passL:foo.o` ?
> If so, you shouldn't need to do anything. C doesn't have namespaces, as long
> as the symbols are not static, they should be accessible (you'll need to
> write a header file with prototypes though).
That’s what I thought too. But Nim didn’t seem to be including the compiled C
files. They’re
If I'm understanding correctly, you are compiling a static or dynamic library,
in which you are including C code using {.compile.}, and you want whatever is
in those C files to be accessible to C code that is linked against your lib (or
Nim via importc I guess)?
If so, you shouldn't need to do
I'm curious how to get Nim to build and export C library components. I've got
some `.exportc.` procs but also want to export some C library functions
imported using `.compile.` or `.importc.`.
Suggestions? I've tried a couple of routes the other day but couldn't get the
right combination.