Python bindings tutorial
Dave Angel
davea at ieee.org
Wed Mar 17 07:14:13 EDT 2010
Stefan Behnel wrote:
> <div class="moz-text-flowed" style="font-family:
> -moz-fixed">MikeLisanke at gmail.com, 17.03.2010 10:08:
>> Its interesting you've mentioned the hard work involved in this
>> interface (binding to an EXE instead of a DLL). A year or more ago I
>> was looking at interfacing IPMITOOL to python. Do to the problems
>> incurred with swig/python I switched to a running the process through
>> its command-line interface. I always felt the problems in interfacing
>> python to an EXE should be worked on (to minimize them), making the
>> direct use of an EXE API's a routine task. I understand some of the
>> problems using an EXE (not running all of its startup code but
>> enough for its proper operation). Have you found this a recurring
>> question? Thanks.
>
> I think the point here is that executable binaries are not supposed to
> be used as libraries. Libraries are. That's the difference between a
> DLL and an executable in the first place. To run an executable,
> execute it. The subprocess module is the tool of choice here. To use a
> DLL, link against it.
>
> Stefan
>
There's no real reason parts of an exe cannot be exported, same as a
dll. They are in fact the same structure. And in fact many other files
in the Windows environment are also the same structure, from fonts to ocx's
Saying they're "not supposed to be used" is like saying that a python
module should not have an
if __name__ == "__main__":
section. After all, who could want to both run a file, and import the
same file??
DaveA
More information about the Python-list
mailing list