extern (c++) std::function?
FreeSlave via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Aug 15 01:24:41 PDT 2014
On Friday, 15 August 2014 at 03:10:43 UTC, Etienne Cimon wrote:
> I'm looking into making a binding for the C++ API called Botan,
> and the constructors in it take a std::function. I'm wondering
> if there's a D equivalent for this binding to work out, or if I
> have to make a C++ wrapper as well?
There are some restrictions about sharing complex types between
C++ and D. Currently only POD-structs and classes with virtual
functions are supported for transparent interaction.
In this case things become even more complicated since
std::function is template class and D can't instantiate C++
templates. You should stick with some predefined signatures and
make wrappers on C++ side, which will accept 'plane' functions
and construct std::function.
More information about the Digitalmars-d-learn
mailing list