On Friday, 27 April 2012 at 13:02:56 UTC, 拖狗散步 wrote:
On Friday, 27 April 2012 at 01:21:56 UTC, Trass3r wrote:
export c callback fun:
alias void function(int id) ConnectedCallBack;
alias void function(int id, void* data, int len) ReadCallBack;
add extern(C) to be safe
Thank, Trass3r! Finally correct, why have to export these two?
You specified the C calling convention with
UnmanagedFunctionPointer(CallingConvention.Cdecl), and extern(C)
means use the C calling convention. Otherwise they'll be
expecting a function using the D calling convention, which is
incompatible.