Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > embed python dynamically

Reply
Thread Tools

embed python dynamically

 
 
naveen
Guest
Posts: n/a
 
      11-26-2009
How do you embed the python dll file distributed with the automatic
installable python distribution on windows?
Is it possible to dynamically load the python dll from running c
program and start up a python interpreter ?
Do you have to compile python from source to be able to embed python?

 
Reply With Quote
 
 
 
 
naveen
Guest
Posts: n/a
 
      11-26-2009
ok, it was almost intuitive.
just made a simple visual c express dll project
included python26\include and python26\libs in the project settings
the debug version has issues, but the release compiles without a
problem.
here is the source:
http://github.com/tinku99/embedpython
 
Reply With Quote
 
 
 
 
naveen
Guest
Posts: n/a
 
      11-26-2009
ok, its even easier than that.
With autohotkey:

pythondll := DllCall("LoadLibrary", "str", "c:\windows
\system32\python26.dll")
init := DllCall("c:\windows\system32\python26.dll\Py_Initi alize"
, "Cdecl")
msgbox python initalized
call := DllCall("c:\windows\system32\python26.dll\PyRun_Si mpleString"
, "str", "import sys", "Cdecl")
msgbox will exit using python code
call := DllCall("c:\windows\system32\python26.dll\PyRun_Si mpleString"
, "str", "sys.exit(0)", "Cdecl")
init := DllCall("c:\windows\system32\python26.dll\Py_Final ize"
, "Cdecl")
msgbox % never called
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Modify a C++ instance from the embed python interpreter Wezzy Python 2 08-28-2005 12:35 PM
profile python in embed system kyo guan Python 0 05-23-2005 02:49 AM
Embed Python Tommy Ryding Python 0 05-17-2005 06:58 AM
EMBED element - dynamically changing SRC attribute Martin HTML 2 12-16-2003 10:37 AM
Trying to embed python into C, help! disgracelands Python 2 08-10-2003 08:06 PM



Advertisments