You could try inserting a define pragma in the module, fx. in the module that you want to debug, insert the following code at the top, after any imports (just to be safe)
# Imports
import std/strutils
# Define pragma
{.define: debug.}
And then compile the entire project with -d:release
I don't know if this fully works but, it should only enable debug for that specific module.
Any plans to support such kind of things in nimony?
Say I split off that heavy part of my code into a separate library that can be precompiled into an .so or .a. The docs are a bit vague about how do to this exactly, and what are the gotchas. Also, do I understand correctly that I'll need two .nim files, one with procs decorated with exportc to be compiled, the other with proc declarations decorated with importc and to be imported in my app?
Any plans to support such kind of things in nimony?
Kind of, all you need to do is to patch the nifmake file or creating some tooling that does that for you.
Also, do I understand correctly that I'll need two .nim files, one with procs decorated with exportc to be compiled, the other with proc declarations decorated with importc and to be imported in my app?
No, that is not required. Instead follow the stdlib's example:
when defined(createRtl):
when defined(useRtl):
{.error: "Cannot create and use rtl at the same time!".}
elif appType != "lib":
{.error: "rtl must be built as a library!".}
when defined(createRtl):
{.pragma: rtl, exportc: "myrtl_$1", dynlib.}
{.pragma: inl.}
elif defined(useRtl):
#[
`{.rtl.}` should only be used for non-generic procs.
]#
const myrtl* =
when defined(windows): "myrtl.dll"
elif defined(macosx): "libmyrtl.dylib"
else: "libmyrtl.so"
{.pragma: rtl, importc: "myrtl_$1", dynlib: nimrtl.}
{.pragma: inl.}
else:
{.pragma: rtl.}
{.pragma: inl, inline.}