Yesterday, I got part of my answer about passing a python function to a
C/c++ class. But, what was left out was passing the Python function to the
c/c++ program, the docs did the same thing unless I skipped it.
Ex. This is taken from a modified beer.py
import testmeth
n = 20
#if sys.argv[1:]: n = int(sys.argv[1])
def setN(x): #this is the function I want to send to C/C++
x = n
def bottle(n):
if n == 0: return "no more bottles of beer"
if n == 1: return "one bottle of beer"
return str(n) + " bottles of beer"
testmeth.testmeth(13,9)
testmeth.test(setN) #Here I am trying to make the call to my C/C++
function, but I get an error
for i in range(n):
print bottle(n-i), "on the wall,"
print bottle(n-i) + "."
print "Take one down, pass it around,"
print bottle(n-i-1), "on the wall."
print n
C/c++ class. But, what was left out was passing the Python function to the
c/c++ program, the docs did the same thing unless I skipped it.
Ex. This is taken from a modified beer.py
import testmeth
n = 20
#if sys.argv[1:]: n = int(sys.argv[1])
def setN(x): #this is the function I want to send to C/C++
x = n
def bottle(n):
if n == 0: return "no more bottles of beer"
if n == 1: return "one bottle of beer"
return str(n) + " bottles of beer"
testmeth.testmeth(13,9)
testmeth.test(setN) #Here I am trying to make the call to my C/C++
function, but I get an error
for i in range(n):
print bottle(n-i), "on the wall,"
print bottle(n-i) + "."
print "Take one down, pass it around,"
print bottle(n-i-1), "on the wall."
print n