On 17-05-2020 18:53, Russel Winder wrote:

Using a Gio.SocketClient one can connect asynchronously to a server using connectAsync. This requires supplying a function with the signature extern(C) void connectionCallback(GObject* object, GAsyncResult* result, void * userData). This function is supposed to call connectFinish to complete the data collection. In C this is easy as the parameter to connectFinish is a GAsyncResult*, exactly the result parameter to connectCallback. However the signature in D requires the parameter be an AsyncResultIF. So the question is how does one create an instance of an AsyncResultIF from a GAsyncResult* 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);