export extern (C) void Fun Error

"拖狗散步" djj at shumtn.com
Sat Apr 28 06:54:38 PDT 2012


On Friday, 27 April 2012 at 15:04:48 UTC, Matt Peterson wrote:
> 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.

The original so thank you



More information about the Digitalmars-d mailing list