[Tutor] question about pure exe and dll

Magnus Lyckå magnus@thinkware.se
Mon Jun 2 09:10:04 2003


At 08:42 2003-06-02 +0200, Guillaume wrote:
>I've got a little question : how can we access to the DLL libraries under
>W$ (I don't know it was possible) and create some others?

This is obviously two completely different questions.

First of all: Why do you what to do this? What's your purpose?

You can access DLLs in Windows and the corresponding stuff
in Linux and MacOS with Thomas Heller's ctypes. See:
http://starship.python.net/crew/theller/ctypes/

So, for instance, here are two different ways to tell how
many seconds have passed since the beginning of 1970...

 >>> from ctypes import *
 >>> import time
 >>> cdll.msvcrt.time(None); time.time()
1054558665
1054558665.498

time.time() is obviously a normal call to a python standard module.
cdll.msvsrt.something means that you call something in the MS Visual
C RunTime DLL.

There is also a similar package by Sam Rushing, but I think
ctypes is much more actively developed now.

When you talk about creating DLLs, you have to tell what kind
of DLLs you mean: DLLs that are to be accessed as python modules
from a python script, or DLLs that are to be accessed by other
programs, that include Python code.

I explained parts of this in my response to Alan Monroe.

See also
thinkware.se/cgi-bin/thinki.cgi/UsingPythonWithOtherLanguages


--
Magnus Lycka (It's really Lyckå), magnus@thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The shortest path from thought to working program