Closed Laeeth closed 5 years ago
dpp is a separate binary that must be run in a preprocessing step though.
Nim can do it natively, here are some examples:
# from a header, with optional rename
proc c_fprintf*(f: CFilePtr, frmt: cstring): cint {.importc: "fprintf", header: "<stdio.h>", varargs, discardable.}
# from a dynamically loaded lib
proc foobar*() {.importc, dynlib: "libmyfun.dylib".}
# from embedded code (a bit similar to how go does c interop)
proc foobar2() {.importc.}
{.emit:"""
#include <stdio.h>
void foobar2(){
printf("in foobar2\n");
}
""".}
D can just include C headers using dpp. I guess Nim can do so natively?