Hello, Nim community!

I'm working on macros which allows usage of C++ libraries from C backend with 
minimal effort. During reflection on the idea I've encountered some questions:

  * Is there a way to determine which backend is used to compile current file? 
It's necessary for constructions like:


    
    
    when isCppBackend:
      ... # use typical importcpp pragma
    when isJSBackend:
      ... # error message
    when isCBackend:
      ... # use some magic to represent C++ objects in C terms
    

  * Is there a way to obtain Nim or C++ compiler command used at compile time? 
The idea is to call C++ or Nim (with C++ backend) compiler and run "spy code" 
to determine class field offsets, mangled names (for fast and unsafe calls) and 
other C++ specific things.



The part of the idea realization (without C backend support) can be found 
[here](https://github.com/xomachine/wraptool-cpp2nim)

Reply via email to