C++ Interop

Timothee Cour thelastmammoth at gmail.com
Fri Jan 5 15:59:49 UTC 2018


see also https://github.com/Syniurge/Calypso/ although I'm having lots
of issues using it on OSX

On Fri, Jan 5, 2018 at 9:02 AM, qznc via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> wrote:
> I'm exploring [0] C++ interop after watching Walter's presentation [1].
>
> I hit a block with classes as template parameters. This means vector<int>
> works, but vector<Foo> does not. D seems to map vector!Foo to vector<Foo*>.
> Likewise shared_ptr<Foo> is a problem. Any way to fix that on the D side?
> The ugly workaround is to adapt the C++ code.
>
> I understand that this mapping makes sense for function calls because
> bar(Foo f) in D maps to bar(Foo *f) in C++. And C++ bar(Foo f) has no
> equivalent in D because classes are reference types.
>
> On a related note, C++ interop requires to redeclare or even reimplement C++
> code. Has anybody started a libcpp-in-d project? I'm looking for basics like
> vector and string.
>
> [0] https://github.com/qznc/d-cpptest
> [1] https://youtu.be/IkwaV6k6BmM


More information about the Digitalmars-d-learn mailing list