Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10957 > unrolled thread

Re: Dynamically linking python into my vc project - help required

Started byMark Hammond <skippy.hammond@gmail.com>
First post2011-08-06 16:55 +1000
Last post2011-08-06 16:55 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Dynamically linking python into my vc project - help required Mark Hammond <skippy.hammond@gmail.com> - 2011-08-06 16:55 +1000

#10957 — Re: Dynamically linking python into my vc project - help required

FromMark Hammond <skippy.hammond@gmail.com>
Date2011-08-06 16:55 +1000
SubjectRe: Dynamically linking python into my vc project - help required
Message-ID<mailman.1961.1312613756.1164.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web