Making a DLL with python?

J

jppx1

Can I use python to make a regular Windows DLL that will be called from
other programs?

I know I can use the win32 extensions to make a COM server, but I need
a straight DLL.

Regards,
Phillip
 
L

Larry Bates

I don't think you can make a .DLL (but someone else might).

Why can't you use a COM server? MS seems to have written
some pretty sophisticated software using COM objects.
Almost all languages can dispatch a COM object easily.

-Larry
 
G

Gerald Klix

I think you can, as long as you have a C-Compiler available.

I used pyrex to embedd python into a Linux PAM-Module and
i used C-Types to embbed Python into a Windows DLL. With hindsight, the
pyrex solution was much fatser to develop and less complicated.

Pyrex provides an example.

Ctypes: http://starship.python.net/crew/theller/ctypes/
Pyrex: http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/

Feel free to ask, if you need a more complex example,
than the one, that comes with pyrex.

HTH,
Gerald
 
A

alex23

Larry said:
Almost all languages can dispatch a COM object easily.

Being stuck using VBScript at work, I kind of poked around COM creation
one day and was surprised to find that it's possible to just drop
python script directly into COM objects. Five minutes later and I was
finally using real dicts & lists in VBScript :)

-alex23
 
J

jppx1

I can't use a COM object because I'm trying to integrate with someone
else's product, and they will only accept a DLL.

I've already written the basics of the DLL in C++, but doing so has
reminded me why I grew to dislike C++!

I'd love to do the whole thing in Python, but I don't know how to make
a DLL purely from Python.
 
G

Greg Ewing

I'd love to do the whole thing in Python, but I don't know how to make
a DLL purely from Python.

I don't think you can do it *purely* in Python. You'll at
least need a C or Pyrex wrapper which dispatches to Python
code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top