Interfacing with C++ std::shared_ptr and std::unique_ptr

evilrat evilrat666 at gmail.com
Wed Jun 10 06:53:07 UTC 2020


On Wednesday, 10 June 2020 at 06:43:24 UTC, Andre Pany wrote:
>
> Also, the C++ classes make use of templates. Is it still 
> possible to call these
> classes from D?

It should be, I did something similar and it worked. But it was 
quite some time ago so I don't remember exact situation and any 
details.

However you still be out of luck if the types you are trying to 
use is present in header only, since there is simply nothing to 
link with, so now you have to port whole template to D, or make 
dummy wrapper in C++ that forces the compiler to emit those 
symbols.

Same with ctor/dtors, if you have a class that is only used in 
some executable and not present in any of a .lib/.a form you're 
stuck. This is especially annoying with destructors because it 
renders the whole thing unusable without helper libraries that 
does new/delete in order to get the damn symbols emitted in 
object files to be able to link.


More information about the Digitalmars-d-learn mailing list