Create DLL in Python ?

Chris Tavares christophertavares at earthlink.net
Sun Nov 17 02:39:08 EST 2002


"Georges Bernier" <mistericeberg at hotmail.com> wrote in message
news:1b318b70.0211111607.74ace07 at posting.google.com...
> Hello,
>
> We have a legacy application at work written in Visual C which makes
> use of a DLL for specific communication functions. Now I have to
> replace this DLL (whose API is well documented) with an enhanced
> version which will make use of TCP/IP instead of older protocols
> without changing the original C application (or at least changing the
> minimum possible).
>
> Naturally I was thinking of using Python (as it has great network
> libraries and would simplify the development) but after much googling
> haven't found a clear answer on how to generate standalone DLLs from
> Python (i.e. DLLs which are not Python extensions).
>
> So does anybody have experience in such a thing, is it a bad idea (as
> I'm starting to think is is) and would it better be done in C/C++ ?
> I would appreciate comments from the Python community on this.
>
> Thanks !
>
> Georges Bernier
>

You can't avoid coding in C completely, but you can cut down on the amount
of work tremendously.

What you need to do is write a C DLL. The DLL will implement your API.
Inside the implementation, use the Python API to call from the DLL into your
python code. Essentially embed Python into your DLL. The original app will
just call the DLL and not know that python's involved at all, and you can
write your actual logic in Python.

-Chris






More information about the Python-list mailing list