惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
H
Heimdal Security Blog
腾讯CDC
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
月光博客
月光博客
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
D
DataBreaches.Net
O
OpenAI News
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
小众软件
小众软件
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
美团技术团队
P
Privacy International News Feed

博客园 - 沐枫

git+svn 中文文件名乱码的处理 发展国产基础软件以及反盗版的异想 ASP.NET 日期数据服务端验证失败的原因 Mvc 2.0 Preview2 中 DefaultParameterValue 不支持枚举的Bug DynamicControl/DynamicField 例外的解决 推荐一个不错的flex ajax javascript资源网站 .net winform 的 OnKeyDown 与 方向键 MySQL 5.1 无法创建、修改存储过程的解决(简单问题) 一个稍微好用些的 svn 服务器 VC中的一个很奇怪的问题--关于C4244 汉语编程++ 关于Array.IndexOf 从赋值到初始化 从for到foreach 关注C++0x: Concept Ultimate Toolbox 开源了 关于C#2.0编译器的一个瘕疵 VC2008 beta2 的几个新东西 C++指针探讨 (四) 函数对象
boost 1.34 终于简化了内嵌python的支持
沐枫 · 2007-05-23 · via 博客园 - 沐枫

boost 1.34 终于简化了内嵌python的支持。
还支持了python2.5。
在中文windows下用vc8编译boost的过程中,虽然仍有代码页字符警告,但是可以正常编译成功,不再象1.33.1那样造成正则表达式库不修改源码不能够编译通过的问题了。

下面的例子是从boost文档中来的:

#include <iostream>
#include 
<string>
#include 
<boost/python.hpp>
#include 
<boost/ref.hpp>
#include 
<vector>
using namespace boost::python;void greet()
{
    
object main = import("__main__");
    
object global(main.attr("__dict__"));// Define greet function in Python.
    object result = exec(
        
"def greet(a):               \n"
        
"   return 'Hello %s from Python!' % a \n",
        global, global);
object greet = global["greet"];

    list lst;
    lst.append(

1);
    lst.append(
2);object r = greet(lst);

    std::

string message = extract<std::string>(r);
    std::cout 
<< message << std::endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
    Py_Initialize();
    greet();
    system(
"Pause");
    
return 0;
}