[Pyrex] Creating a DLL with Pyrex.

Bob Ippolito bob at redivi.com
Tue Nov 2 20:07:55 CET 2004


On Nov 2, 2004, at 10:48, 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
>
> From what I can see on this page:
> http://www.freenet.org.nz/python/embeddingpyrex/ it seems like it 
> should
> be possible to create a DLL, at least in theory, but I'm fairly lost 
> as to how I would actually go about it.  Can anyone point me at some 
> documentation, or sample projects, or tell me that it can't currently 
> be done, and point me at the appropriate source file to hack in order 
> to get it working, or if I shouldn't do it, why not?

It should be possible.  The only things that should be different are 
implementing GetConduitInfo, etc. instead of main, and the linker 
flags.  You may need to trick Pyrex into emitting that ExportFunc, 
though.

-bob




More information about the Pyrex mailing list