Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #10957
| Date | 2011-08-06 16:55 +1000 |
|---|---|
| From | Mark Hammond <skippy.hammond@gmail.com> |
| Subject | Re: Dynamically linking python into my vc project - help required |
| References | <6cafe6745022b37909647db99073fc87@edss.co.in> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1961.1312613756.1164.python-list@python.org> (permalink) |
On 3/08/2011 6:58 PM, mrinalini@edss.co.in wrote: > Hi, > > I am trying to embed python into my MFC application. I have done this > before by statically linking to the python lib. But I want to change > this now. > The idea is to take the information from the registry for the installed > version of python on the target machine. Then load python using > loadlibrary call and use the functions from python using pointers to > functions returned by GetProcAddress . ... > PyObject* pObject = pFPyEval_EvalCode((PyCodeObject*)pCodeObject, > m_Dictionary, m_Dictionary); > } > > > I am facing two problems here , though I want to link to python > dynamically I am required to include python.h for my code to compile the > following declaration. > > PyObject* pCodeObject You can probably just define pFPyEval_EvalCode as taking a PyObject * (but I'm not sure where you are getting a declaration of PyObject * from) > I tried copying some of the python definitions including PyObject into a > header in my mfc app. Then it complies fine. but Py_CompileString call > fails. so finally I am unable to run script from my MFC application by > linking to python dynamically. Are you sure you have the calling convention correct on those function pointer decls? > How can this be done ? Please help. Is there a different approach to > linking to python dynamically. Please could you write to me ? py2exe takes the same basic approach as you and might be worth copying its declarations for the function pointers? Mark
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Dynamically linking python into my vc project - help required Mark Hammond <skippy.hammond@gmail.com> - 2011-08-06 16:55 +1000
csiph-web