动态库和静态库的导出

来源:互联网 发布:ojbdk是什么意思网络 编辑:程序博客网 时间:2024/05/22 12:52
1.导出动态库:
a.在cpp文件中定义:#define DLLEXPORT extern "C" __declspec(dllexport)


在头文件中:
#ifndef DLLEXPORT
#define DLLEXPORT extern "C" __declspec(dllimport)
#endif


b.在头文件中定义:#define DLLEXPORT extern "C" __declspec(dllimport)
然后再定义一个Export.def(此种方式用到静态库里面会没有导出函数,Export.def在静态库中不起作用)


此2种方式不能用到静态库里面,会提示找不到函数。


c.就只到头文件中声明这个语句:#define DLLEXPORT extern "C" __declspec(dllexport)
此种方式适用于静态库和动态库


2.导出静态库(前面2中方式


a.不声明任何导出信息
0 0
原创粉丝点击