一. 你的Python代码
创建文件Test001.py
代码如下:
#-*- coding:utf-8 -*-
def HelloWorld():
print "Hello World"
def Add(a, b):
return a + b
def TestDictionary(dict):
print dict
dict["Size"] = 100
return dict
class Person:
def SayHi(self, strName):
print "Hi " + strName
二. C++的调用代码(VC2008)
C++需要包含xxxx\Python27下的include和libs目录, 按自己喜欢的方式添加到C++工程即可
#include "stdafx.h"
#include <iostream>
#include <Python.h>
// 调用一个没有参数, 没有返回值的函数,
void TestHelloWorld()
{