pythondll.h文件
#ifndef _PYTHONDLL_H_
#define _PYTHONDLL_H_#ifdef BUILD_DLL
#define OS_API __declspec(dllexport) //如果是生成dll工程,那么导出
#else
#define OS_API __declspec(dllimport) //如果是生成使用dll的工程,那么导入
#endif
class OS_API TestLib{
public:
void display();
void display(int a);
};
#endif
pythondll.cpp文件
#include <iostream>
//#include "python.h"
#include "pythondll.h"
using namespace std;
#ifdef __cplusplus
extern "C" {
#endif
void TestLib::display() {
cout<<"First display"<<endl;
}
void TestLib::display(int a) {
cout<<"Second display"<<endl;
}
#ifdef __cplusplus
}
#endif