[pypy-dev] Extension compiler and external DLLs

Armin Rigo arigo at tunes.org
Sun Aug 27 19:30:01 CEST 2006

Hi Laurent,

On Sat, Aug 26, 2006 at 04:14:11AM +0200, laurent destriau wrote:
> It did for me:
>    from pypy.rpython.rctypes.tool.ctypes_platform import configure, Library
>    class CConfig:
>        _header_ = ""
>        _includes_ = ["windows.h", "gl/gl.h"]
>        gl = Library("opengl32")

This works because of the Library() object, which tells the extension
compiler to pass the appropriate flags to the C linker.  You can get the
same effect by attaching flags directly to the function instead:

       glEnd = windll.opengl32.glEnd
       glEnd.restype = None
       glEnd.includes = ["windows.h", "gl/gl.h"]
       glEnd.libraries = ["opengl32"]
       # nb. untested code

But using a CConfig is better anyway for other reasons, e.g. to avoid
having to hard-code too many details of the type and structure

A bientot,


More information about the Pypy-dev mailing list