There is nothing particularly different when it comes to binding C functions vs 
macros in nim - in the end it is just a codegen.

Though as you mentioned in your comment this can be extremely unreliable due to 
codegen **and** C macros in the same place - stray comma can completely mess up 
everything.
    
    
    {.emit: """
    #define hell(arg) puts(arg)
    """.}
    
    proc hell(arg: cstring) {.importc: "hell", header: "stdio.h".}
    
    let str = "123123"
    
    hell(str.cstring)
    
    Run

PS: I also tried using `.importcpp.` (because it has more feature-full syntax 
for describing codegen patterns), but it seems like this is not possible 
(linker error). 

Reply via email to