[cffi-devel] generate mapping from windows.h with the cffi module of swig

Frank Buss fb at frank-buss.de
Tue Jan 3 04:16:53 UTC 2006


Surendra Singhi wrote:

> You can also try SWIG (cvs version) it fully supports C.

thanks, I've tried it and now it generates a mapping for e.g. TCL (which is
16 mb), but when specifying -cffi, it reports some messages (see below) and
generates only a 6000 line lisp file for CFFI, with all mappings until
GENERIC_MAPPING, but all other missing. Deleting this stops at the next
structure. Looks like the CFFI support is missing some features.

This is the command line I've used:

swig -DGUID_DEFINED -D_TCHAR_DEFINED -D_M_IX86 -D_WIN32 \
     -Iwindows -Iwindows/w32api -includeall -cffi interface.i

and this the interface.i:


%include "windows.i"

%module windows
 %{
 #include "windows.h"
 %}
 
%include "windows.h"


I've used the cygwin header files and patched it a bit to fix some errors,
you can download the package at http://www.frank-buss.de/tmp/cffi.zip 
I'll post this to the cffi-devel mailing list, too, perhaps someone can take
a look at it and fix the cffi swig module.

The error messages:


/usr/local/share/swig/1.3.28/windows.i:6: Warning(453): Can't apply
(unsigned char const &). No typemaps are defined.

/usr/local/share/swig/1.3.28/windows.i:9: Warning(453): Can't apply (signed
char const &). No typemaps are defined.

/usr/local/share/swig/1.3.28/windows.i:12: Warning(453): Can't apply
(unsigned short const &). No typemaps are defined.

/usr/local/share/swig/1.3.28/windows.i:15: Warning(453): Can't apply (short
const &). No typemaps are defined.

/usr/local/share/swig/1.3.28/windows.i:18: Warning(453): Can't apply
(unsigned int const &). No typemaps are defined.

/usr/local/share/swig/1.3.28/windows.i:21: Warning(453): Can't apply (int
const &). No typemaps are defined.

/usr/local/share/swig/1.3.28/windows.i:23: Warning(453): Can't apply
(unsigned long long). No typemaps are defined.

/usr/local/share/swig/1.3.28/windows.i:24: Warning(453): Can't apply
(unsigned long long const &). No typemaps are defined.

/usr/local/share/swig/1.3.28/windows.i:26: Warning(453): Can't apply (long
long). No typemaps are defined.

/usr/local/share/swig/1.3.28/windows.i:27: Warning(453): Can't apply (long
long const &). No typemaps are defined.

Structure GENERIC_MAPPING has a slot that we can't deal with.
nodeType: access, name: , type:


with this typedef for ACCESS_MASK:

typedef DWORD ACCESS_MASK, *PACCESS_MASK;


-- 
Frank Buss, fb at frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de




More information about the cffi-devel mailing list