Embedding Python in C++ Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gavinpaterson

    #1

    Embedding Python in C++ Problem

    Dear Pythoners,

    I am trying to embed a Python script into a C++ application for the
    first time.

    Although I have used the example 5.3 Pure Embedding I am having
    problems with calling the function defined in my program.

    If I define function multiply in module "multiply.p y"

    def multiply(a,b):
    print "Will compute", a, "times", b
    c = 0
    for i in range(0, a):
    c = c + b
    return c

    Then call the program with the following arguments:

    multiply multiply 2 3

    Then I'd expect to see the result appear in stdout. The compiled
    module is found but the program fails to get past:

    if (pFunc && PyCallable_Chec k(pFunc))

    I am using VC7.1 on windows XP. Where am I going wrong?






Working...