[warning C novice here]
I've been playing with typemap. Hoping I could create a typemap that would
allow me to access functions from the Win32API using ENABLE => AUTOWRAP for
function declarations.
Most Win32 api functions use pascal calling conventions. For instance, in
winuser.h the function declaration for MessageBoxA is:
WINUSERAPI
int
WINAPI
MessageBoxA(
HWND hWnd ,
LPCSTR lpText,
LPCSTR lpCaption,
UINT uType);
might translate roughly to:
__declspec(dllexport)
int
__pascal
MessageBoxA(
long hWnd ,
char* lpText,
char* lpCaption,
int uType);
Using a typemap file containing:
HWND T_LONG
LPCSTR T_PV
UINT T_UV
I can get the following function definition to work:
int Message_Box_A(
HWND hWnd,
LPCSTR lpText,
LPCSTR lpCaption,
UINT uType) {
printf("%d, %s, %s, %d\n", hWnd, lpText, lpCaption, uType);
return 1;
}
But the compiler directives are throwing me when it comes to enabling
autowrapping function declarations.
use Inline C => Config => ENABLE => AUTOWRAP
=> LIBS => '-luser32'
=> TYPEMAPS => './typemap';
use Inline C => DATA;
MessageBoxA(0, "text", "caption", 0);
__END__
__C__
#include <windows.h>
???
Is it possible to autowrap functions with different calling conventions? If
so, what do I need to provide to make it work?