文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>如何用boost.python编写python扩展

如何用boost.python编写python扩展

时间:2010-11-29  来源:LinuxHunter

#include "stdafx.h"

#include <boost/python.hpp>

#define EXPORT_SYMBOL_TO_PYTHON(x) boost::python::def(#x, x)

void Recognise(PyObject* pObj)
{
   MessageBoxA(NULL, ((PyStringObject*)pObj)->ob_sval, "message", MB_OK );
}

BOOST_PYTHON_MODULE(DllForPython)
{
    EXPORT_SYMBOL_TO_PYTHON(Recognise);
}
 
Python脚本调用部分(将DLL扩展目录加入到sys.path):
 
# -*- coding: gbk -*-

import sys
sys.path.append('./Debug')
import DllForPython
DllForPython.Recognise("Everything is OK")
相关阅读 更多 +
排行榜 更多 +
幸运硬币官方正版下载

幸运硬币官方正版下载

休闲益智 下载
宝宝来找茬手机版 v9.86.00.00 安卓版

宝宝来找茬手机版 v9.86.00.00 安卓版

休闲益智 下载
翻滚飞机大战最新版 v1.0.4 安卓版

翻滚飞机大战最新版 v1.0.4 安卓版

飞行射击 下载