I have a c++ struct:

template <typename retval>
struct ezDelegate<retval ()>
{
}

void DelegateTest(ezDelegate<void ()> func) { ... }

And I want to match that on the D side, unfortunately it does not work:

D:
struct ezDelegate(Signature) {}

alias delegate_t = ezDelegate!(void function());

extern(C++) void DelegateTest(delegate func);

D mangles
?DelegateTest@@YAXU?$ezDelegate@$$A6AXXZ@@@Z
void __cdecl DelegateTest(struct ezDelegate<void (__cdecl*)(void)>)

What C++ does:
?DelegateTest@@YAXU?$ezDelegate@P6AXXZ@@@Z
void __cdecl DelegateTest(struct ezDelegate<void __cdecl(void)>)

I understand that "void function()" is actually a function pointer and thus the mangling is "correct". But in what way would you actually able to mirror the C++ declaration of ezDelegate? Does it even work? This would be a central part of my interop with C++ so making it work would be nice.

Kind Regards
Benjamin Thaut

Reply via email to