Status of Win32 C++ interop
Benjamin Thaut via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Sep 10 00:46:45 PDT 2015
On Tuesday, 8 September 2015 at 12:56:00 UTC, Laeeth Isharc wrote:
>
>
> This is really very clear and helpful, and I appreciate your
> taking the time. I will place it on the wiki if that's okay.
Thats ok.
>
> Library support is surely one of the largest impediments to the
> adoption of D, and we ought to place some emphasis on updating
> the documentation here:
> http://dlang.org/cpp_interface.html
>
> How does it work when external APIs expect objects from the C++
> standard library? strings, and so on? How about funny pointer
> types? shared_ptr etc? std::vector, std::list?
For templated types like std::vector, std::list and shared_ptr
you have two options:
- Redo the complete implementation on the D side ensuring that
the data layout is the same
- Or, expose helper functions which call placement new /
desturctor of your needed std::vector<T> and do the hidden data
trick I described above. The regular functions of std::vector
just have to be declared and the linker will find them if and
only if the c++ side instanciated the template.
>
> Here is one C++ library used by many in finance (at least as a
> backup). I think there might be a decent amount of value in
> making this usable from D. (Trying to put my own interests
> aside!) Paging Andy Smith ?
>
> http://quantlib.org/reference/_bermudan_swaption_8cpp-example.html
I think you have to make this usable from D yourself ;-)
>
> Are there any well-known C++ libraries that you have interfaced
> to ? Could you give some examples of how long it takes ?
I'm interfacing to a 3D engine I'm working on in my spare time
with some collegues. So no well known C++ library.
>
> Would you be able to drop me an email about something else? No
> contact info on your blog, but my domain is
> kaleidicassociates.com and my user id is laeeth@
Will do.
Kind Regards
Benjamin Thaut
More information about the Digitalmars-d-learn
mailing list