perl embeded into c++ 完全攻略
2005-06-07 15:43
302 查看
perl embeded into c++
document.title="perl embeded into c++ - "+document.title
完全攻略
step 1:
要想在Microsoft Developer Studio中使用perl首先要运行:
perl -MextUtils::Embed -e xsinit
生成perlxsi.c(perlxsi.cpp)文件.
Step2:
创建工程,选中创建空白工程的选项,再添加自己的源代码,这样产生的工程不会有多余的文件,默认也不使用预编译头。
Project->Win32 Consol Application-> an empty project
step3
然后在生成的vc工程中将perlxsi.c和perl.lib文件添加到Source Files文件夹中,这里注意perl.lib根据版本的不同也有不同,要到安装perl的文件夹下perl/lib/core中具体查找,比如我的就是perl58.lib。
具体做法: 在VC打开时,这样添加project->Add to project->Files
除此之外,还要在vc的工具-〉选项-〉目录中将相关的库文件添加进来,我是这样设的:
Executable files:x:/perl/bin
Include files:x:/perl/lib/core
Library files:x:/perl/lib/core
Step4
测试程序如下
#include "EXTERN.h"
#include "perl.h"
static PerlInterpreter *my_perl;
int main(int argc, char **argv)
{
char* command_line[] = {"", "-e","print /"Hello from C!//n/";"};
my_perl = perl_alloc();
perl_construct(my_perl);
perl_parse(my_perl, NULL, 3, command_line, (char **)NULL);
perl_run(my_perl);
perl_destruct(my_perl);
perl_free(my_perl);
return 0;
}
document.title="perl embeded into c++ - "+document.title
完全攻略
step 1:
要想在Microsoft Developer Studio中使用perl首先要运行:
perl -MextUtils::Embed -e xsinit
生成perlxsi.c(perlxsi.cpp)文件.
Step2:
创建工程,选中创建空白工程的选项,再添加自己的源代码,这样产生的工程不会有多余的文件,默认也不使用预编译头。
Project->Win32 Consol Application-> an empty project
step3
然后在生成的vc工程中将perlxsi.c和perl.lib文件添加到Source Files文件夹中,这里注意perl.lib根据版本的不同也有不同,要到安装perl的文件夹下perl/lib/core中具体查找,比如我的就是perl58.lib。
具体做法: 在VC打开时,这样添加project->Add to project->Files
除此之外,还要在vc的工具-〉选项-〉目录中将相关的库文件添加进来,我是这样设的:
Executable files:x:/perl/bin
Include files:x:/perl/lib/core
Library files:x:/perl/lib/core
Step4
测试程序如下
#include "EXTERN.h"
#include "perl.h"
static PerlInterpreter *my_perl;
int main(int argc, char **argv)
{
char* command_line[] = {"", "-e","print /"Hello from C!//n/";"};
my_perl = perl_alloc();
perl_construct(my_perl);
perl_parse(my_perl, NULL, 3, command_line, (char **)NULL);
perl_run(my_perl);
perl_destruct(my_perl);
perl_free(my_perl);
return 0;
}
相关文章推荐
- perl embeded into c++
- C++指针 完全攻略(1)
- windows环境VS2015编译TensorFlow C++程序完全攻略
- 【C/C++】BOOST 线程完全攻略 - 基础篇
- C++字符串完全指引之一 —— Win32 字符编码
- C++资源之不完全导引 [上]
- C++资源之不完全导引(完整版)
- 《C++字符串完全指南——第一部分:win32 字符编码》
- BOOST 线程完全攻略 - 基础篇
- C++字符串完全指引之一 —— Win32 字符编码
- Esxi 5.0+Vsphere+自动启动虚拟机完全攻略
- C++设计模式编程中使用Bridge桥接模式的完全攻略
- Linux下最新版R源码安装完全攻略
- C++“多线程安全”编程完全剖析
- DataGrid 完全攻略之四 (实现统计)
- C++资源之不完全导引(完整版)转
- Visual C++剪贴板操作不完全攻略
- C++字符串完全指引之二 —— 字符串封装类
- JAVA从控制台中读取数据完全攻略
- Apache服务器完全攻略