[Gtk-sharp-list] CallingConvention.Cdecl is not on every DllImport's in Gtk#

Christian Hoff Christian_Hoff at gmx.net
Wed May 26 15:27:26 EDT 2010

-------- Original message --------
> Date: Tue, 25 May 2010 22:10:14 +0200
> From: Ulrich Buchgraber <ulrich.b at gmx.at>
> To: gtk-sharp-list at lists.ximian.com
> Betreff: [Gtk-sharp-list] CallingConvention.Cdecl is not on every	DllImport\'s in Gtk#

> Why are there not all [DllImport()]'s in the Gtk# sources flagged with
> theCallingConvention.Cdecl attribute?

Originally we specified the Cdecl calling convention only for callbacks. After 2.12 we added the attribute also for all DllImports.

The default StdCall works just fine when calling native code via DllImports with the exception that it produces a memory leak since the caller(Gtk#) is expected to free the stack, which it does not do because .net assumes StdCall and therefore that Gtk+ will clean the stack.

We used a regular expression to add the Cdecl attribute back then, so either the RegEx was wrong and did not catch all the dll imports or the import has been added afterwards and the Cdecl attribute has simply been forgotten.
> For example the dll import of the function
> "g_spawn_async_with_pipes_utf8()" ingtk-sharp/glib/Spawn.cs in line 146 (current SVN trunk).
> And there are really many dll imports where the CallingConvention.Cdecl
> flagis missing.

Could you please file a bug report (www.mono-project.com/Bugs) for this? Of course, we would also very much appreciate a patch as we are somewhat short-handed and it is unlikely that we will have the time to fix this soon :-).
> --
> KR, Ulrich
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

More information about the Gtk-sharp-list mailing list