On Saturday, 1 February 2020 at 10:21:54 UTC, norm wrote:
On Saturday, 1 February 2020 at 08:38:22 UTC, Luhrel wrote:
On Saturday, 1 February 2020 at 08:32:51 UTC, Ferhat Kurtulmuş wrote:
On Saturday, 1 February 2020 at 08:27:07 UTC, Luhrel wrote:
On Saturday, 1 February 2020 at 08:21:29 UTC, Ferhat Kurtulmuş wrote:
[...]

Oh I see, so there's definitively no way to call a c++ ctor without modifying the c++ code ?

İf you are not allowed to modify that c++ code, you can write a createInstance function in your custom cpp file.

That was my fear.

It isn't too bad, you need a simple wedge written in C++ that returns an instance of any T you want. A simple template function usually works, or to make it more generic you can use a variadic template to handle N args, but I find variadic templates in C++ are still annoying to use.

And do not forget to write a void cppDestroy(T instance) function that runs delete instance in c++ so that you can call it from D code.

void cppDestroy(T instance)

Reply via email to