环境:Window 10,VS 2019, Python 2.7.12, 64bit 1,打开 VS 2019,新建C++ Windows 动态链接库工程 Example,加入下列文件,如果Python是64位的则在VS中 Solution platforms 选择 x64 编译成64位的 DLL; Example.h #pragma once#ifndef CPP_EXPORTS#define CPP_EXPORTS#endif#ifdef CPP_EXPORTS#define CPP_API _declspec(dllexport)#else #define CPP_API _declspec(dllimport)#endif#include iostreamusing namespace std;#ifdef __cplusplusextern "C"{#endif CPP_API int __cdecl getInt(); CPP_API const char* __cdecl getString(); CPP_API void __cdecl setString(const char* str);#ifdef __cplusplus}#endif Example.cpp #include "pch.h"#include "Example.h"CPP_API int __cdecl getInt(){ return 5;}CPP_API const char* __cdecl getString(){ return "hello";}CPP_API void __cdecl setString(con……
matlab趣味程序,小学生C++趣味编程 PDF 全资料版
最新推荐文章于 2022-12-18 10:26:05 发布
本文介绍了如何在Windows 10环境下,使用Visual Studio 2019创建C++ Windows动态链接库,并与Python 2.7.12进行64位兼容。内容包括设置Solution平台,声明导出函数,以及实现基本的API接口调用。
摘要由CSDN通过智能技术生成