世事洞明皆学问,人情练达即文章nahuat.blog.chinaunix.net
nahuat
全部博文(70)
2013年(1)
2011年(5)
2010年(3)
2009年(9)
2008年(17)
2007年(6)
2006年(29)
htdayday
antonym5
pamire
chq7920
maya1982
shilf200
lxinhcn
zhanhc
nickynik
分类:
2009-05-13 19:28:08
class goods: def __init__(self, price): self.price = price def sale(self, amount): return self.price * amount
#include <iostream> #include <string> #include <boost/python.hpp> #include <boost/ref.hpp> using namespace boost::python; int main(int argc, char* argv[]) { Py_Initialize(); object sys = import("sys"); object path = sys.attr("path"); path.attr("append")("."); object example = import("example"); object goods = example.attr("goods")(1.23); object rc = goods.attr("sale")(1.1); std::cout << extract<float>(rc) << std::endl; return 0; }
上一篇:build libtorrent-rasterbar-0.14.3 with VS.NET 2005
下一篇:python一种分派消息的方法
登录 注册