how do I pass this callback?
Marc
jckj33 at gmail.com
Thu Mar 8 17:06:05 UTC 2018
How do I define the callback so that it can be used in
RegisterWaitForSingleObject()?
I've tried pass as argument:
myFunc
&myFunc
myFunc.ptr
none worked. Here's my code:
>extern (C) void OnExited(void* context, BOOLEAN isTimeOut);
>
>extern(Windows):
> BOOL RegisterWaitForSingleObject(
> PHANDLE phNewWaitObject,
> HANDLE hObject,
> WAITORTIMERCALLBACK Callback,
> PVOID Context,
> ULONG dwMilliseconds,
> ULONG dwFlags
> );
Function call:
> RegisterWaitForSingleObject(&hWait, hProcess, &OnExited, NULL,
> INFINITE, WT_EXECUTEONLYONCE);
Error:
> function a.RegisterWaitForSingleObject(void** phNewWaitObject,
> void* hObject, extern (Windows) void function(void*, bool)
> Callback, void* Context, uint dwMilliseconds, uint dwFlags) is
> not callable using argument types (void**, void*, extern (C)
> void function(void* context, bool isTimeOut), typeof(null),
> uint, uint)
> a.d(38): cannot pass argument & OnExited of type extern
> (C) void function(void* context, bool isTimeOut) to parameter
> extern (Windows) void function(void*, bool) Callback
More information about the Digitalmars-d-learn
mailing list