[Mono-list] std call, how we do it in SWF

Dennis Hayes DENNISH@Raytek.com
Thu, 19 Dec 2002 10:49:09 -0800


Here is how we do windows dll calls in SWF.

		[DllImport ("user32.dll", 
			 CallingConvention = CallingConvention.StdCall, 
			 CharSet = CharSet.Auto)]
		internal static extern int MessageBoxA (
			IntPtr hWnd, string pText, string pCaption, uint
uType);

Dennis

Message: 9
Subject: Re: [Mono-list] Mono/.NET delegate incompatibility
From: Miguel de Icaza <miguel@ximian.com>
To: "J. Perkins" <jason@379.com>
Cc: Mono-L <mono-list@ximian.com>
<1040243062.1202.36.camel@gsk-94k9kupb3ej.rdmdev.ha.uk.sbphrd.com>
Organization:
Date: 18 Dec 2002 19:41:30 -0500

Hello,

> I am using a delegate to pass a function pointer into a unmanaged DLL.
> Under Linux/Mono everything works fine. Under Windows/.NET, my callback
> function signature must look like this:
> 
>   void (__stdcall *func)(int);
> 
> But Windows/Mono seems to want:
> 
>   void (*func)(int);

__stdcall is a Microsoft-C feature, so it is really a feature of your
compiler.  There are some macros around that you can use to make your C
code portable (not really Mono's domain), like STDCALL that get defined
to nothing on Unix.

Miguel