[Pyrex] Creating a DLL with Pyrex.

Phillip J. Eby pje at telecommunity.com
Wed Nov 3 03:37:49 CET 2004


At 10:48 AM 11/2/04 -0500, Blake Winton wrote:
>The Background: I'm trying to create a Palm Conduit using Python.
>   I've currently got it working using Palm's COM API, but that solution
>   is not portable across platforms, so I'ld like to switch over to
>   Palm's C API.
>
>The Problem: I think I've learned enough to be able to wrap the
>   necessary parts of the C API using Pyrex, but in order to get the
>   conduit installed, I need to turn it into a DLL which exposes the
>   following entry points:
>   ExportFunc long GetConduitInfo(ConduitInfoEnum infoType, void
>     *pInArgs, void *pOut, DWORD *pdwOutSize)
>   ExportFunc DWORD GetConduitVersion() and
>   ExportFunc long OpenConduit(PROGRESSFN pFn, CSyncProperties& rProps)
>
>   I believe that py2exe will be unable to help me in this task, since it
>   doesn't have the ability to specify the C signatures of the funtions,
>   and to the best of my knowledge, there's no type-library/interface
>   concept for dlls, as there is for COM servers.  Pyrex seems like it
>   will let me specify the C signatures, but I can't see any way to add
>   in automatically generated code

You might be able to do the 'ExportFunc' declarations in a .h file and 
include it in the Pyrex file.  If not, you'll need to write a short .c file 
with the functions that then invokes public cdef functions from the .pyx file.

Also, to build the DLL, you can probably use the distutils; it's just that 
the distutils generate a .pyd file.  Rename it to .dll and you should be 
set, as .pyd's are actually .dll's internally.




More information about the Pyrex mailing list