Is there any pragma that hints the c compiler to link a static library? Is there a pragma to force c++ compilation?
Thoose would be nice to avoid passing flags to the compiler manually, since a module can be dependent on thoose things.
Looked quickly in the manual but didnt find anything about it, so I ask here.
For example: {. staticLib: "myLibrary.a" , cplusplus.}
There's no pragma to force c++ compilation, instead you pass the command c, cpp or objc to select a compilation mode.
With regards to static linking, this is a TODO for the whole stdlib. Most, if not all of the current modules use dynamic linking, Araq welcomes patches to improve that, though. Since there's no official attempt to do it, maybe we can figure out something here:
Later, in a module, you could write code similar to:
when defined(staticLibs) or defined(staticLibsModuleName):
{. pragmas for static linking .}
else:
{. pragmas for dynamic linking .}
See included file:
https://github.com/Araq/Nimrod/blob/master/lib/wrappers/cairo/cairo_pragma.nim
And how it's used in:
https://github.com/Araq/Nimrod/blob/master/lib/wrappers/cairo/cairo.nim