Yet another approach is to have the `nim c`-generated C code just `#include
"foo.c"` via `{.importc: "func", header: "foo.c".}`.
If you include C code directly in a Nim repo, you may eventually want to use
your new Nim library from other Nim code. In that case, you have to to pass
compiler flags in a special way, since the Nim compiler (unfortunately) does
not do this for you automatically.
c file left as exercise for reader.
{.compile: "only_adds_ints.c".}
proc add_int(a, b: cint): cint
{.importc: "add_int".}
echo add_int(1, 2)
#[
alternatively using emit
{.emit: """
/*INCLUDESECTION*/ // if you want this placed near the
Hi everyone,
I know that in Nim is possible to call C functions compiled to a shared
library, but I was wondering if it could be possible to compile a C file with a
set of functions directly with the Nim source, without having to compile the C
file to a shared library first. If this is