On 17-05-2020 18:53, Russel Winder wrote:
Using a
Gio.SocketClient
one can connect asynchronously to a server usingconnectAsync
. This requires supplying a function with the signatureextern(C) void connectionCallback(GObject* object, GAsyncResult* result, void * userData)
. This function is supposed to callconnectFinish
to complete the data collection. In C this is easy as the parameter toconnectFinish
is aGAsyncResult*
, exactly the result parameter toconnectCallback
. However the signature in D requires the parameter be anAsyncResultIF
. So the question is how does one create an instance of anAsyncResultIF
from aGAsyncResult*
in D. The subsidiary question is why does this have to be done in D when it is not needed in C?
The callbacks using the unwrapped c parameters is something that needs
some work.
To get a D object from a C pointer you can use:
ObjectG.getDObject!AsyncResultIF(your_result);