According to the language manual you can wrap 'new' together with the type name 
so that nim automatically use new.

<https://nim-lang.org/docs/manual.html#importcpp-pragma-importcpp-for-procs>
    
    
    proc newFoo(a, b: cint): ptr Foo {.importcpp: "new Foo(@)".}
    
    
    Run

which is kinda nice, however its counterpart of delete is not documented.

Can you wrap delete in a similar way so that the deconstructor is also run?

Also similarly is it possible to use the nim GC allocator instead, so that the 
C++ constructor/deconstructor are run when being constructed/deconstructed 
during allocation and when the object goes out of scope?

Reply via email to