On 2014-01-13 05:29, Jesse Phillips wrote:

I'm not sure that there is anything specific needed where /*64*/
comments exist, the tool would have a lot of work to translate many
types and not just a single cast.

Yes, it needs to translate signatures as well, as you mention below.

But I did find where there is more work. The segfault pointed to:

     org.eclipse.swt.widgets.Display.Display.windowProcFunc3()

It also good to verify that the snippet work for 32bit as well.

Which is defined as:

     private static extern(C) int /*long*/ windowProcFunc3 (int /*long*/
handle, int /*long*/ arg0, int /*long*/ user_data) {

which is assigned as:

     GCallback windowProc3 = cast(GCallback)&windowProcFunc3;

Where GCallback is defined as:

internal.gtk.OS.d
     public alias org.eclipse.swt.internal.c.glib_object.GCallback
GCallback;

     alias _BCD_func__2331 GCallback;
     alias void function() _BCD_func__2331;

I don't understand why it is cast to a function which takes no
arguments, but suspect that fixing the signatures for /*long*/ is a good
direction.

The original type GCallback[1] is defined to take no arguments and return "void". Although I see that it doesn't mean the callback must take no arguments and return "void".

I have not worked with the Linux port, but in the Mac OS X port they basically merge all callbacks with the same amounts of arguments to a single function. In this case "windowProcFunc3", would handle all callbacks taking three arguments.

Technically I don't think the signature matters, as long as the correct calling convention is used. Where "correct" is whatever is expected from the callback and/or the function invoking the callback.

I don't know which type here is best to use. In the Mac OS X port there is a single type that covers all types except for structs.

https://developer.gnome.org/gobject/stable/gobject-Closures.html#GCallback

--
/Jacob Carlborg

Reply via email to