Hello dear Nim community!
I'm looking for a way to specify compilation target (backend) for particular .nim source file. For example, there is the file describing FFI to C++ library:
# ffi.nim
proc someCppFunction() {.importcpp:"somenamespace::somefunction()".}
proc someFunction*() {.exportc.} =
someCppFunction()
and the file with code that uses the interface:
# file.nim
# Will be compilled via
# nim c file.nim
from ffi import someFunction
someFunction()
Is there a way to compile first file via C++ backend and other file via C then link their .o files in usual way? I would prefer something like pragma:
# ffi.nim
{.target:cpp.} # Force this file to compile via C++ backend
proc someCppFunction() {.importcpp:"somenamespace::somefunction()".}
proc someFunction*() {.exportc.} =
someCppFunction()