Making DLL from a Python program?

Chris Liechti cliechti at gmx.net
Wed Oct 16 18:30:18 EDT 2002


Hung Jung Lu <hungjunglu at yahoo.com> wrote in 
news:mailman.1034775861.17815.python-list at python.org:
> (My need is the following: Python is great for many
> things, but calling Python from Office applications
> like Excel is a bit awkward, I have used win32com but
> that requires registration of COM objects... many
> users don't have admin privilege for that. If I use an
> executable for the Python part, the problem is data
> communication with Excel is not nice: file operations
> are often needed. DLL seems to be the right way to go.

well i don't know much about VB (and i don't want to change that :-), but
couldn't you use something like that (untested):
---
Declare Sub Py_Initialize Lib "python22" 
Declare Sub Py_Finalize Lib "python22"
Declare Sub PyRun_SimpleString Lib "python22" (codesnippet As String)

Py_Initialize
PyRun_SimpleString("print 'hello world'")
Py_Finalize
---
you can put the python helpers in a module in the site-packages directory 
and just use import etc.

chris
-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list