写C++ DLL时需要写的外部接口头文件

    xiaoxiao2021-03-25  128

    #ifndef WAVELET2D_H #define WAVELET2D_H #include <vector> #include <complex> using namespace std;       //the dll exports #if defined WAVE_EXPORT #define EXPORT __declspec(dllexport) #else #define EXPORT __declspec(dllimport) #endif extern "C"

    EXPORT void get_decompose_signal(float *sig, int data_len, float *i_dwt_out);

    2,在编写DLL的时候,在项目属性--》c/c++ ---》预处理器定义中,有要定义的出口的名字,比如这里的WAVE_EXPORT,防止出现DLL链接不一致的错误。

    3,对比一下,发现特点,自己方便写

    #include <string> #include <algorithm> using namespace std; //the dll exports #if defined LVDLL_EXPORTS #define EXPORT __declspec(dllexport) #else #define EXPORT __declspec(dllimport) #endif extern "C" EXPORT  void get_decompose_signal(float *sig, int data_len, float *i_dwt_out); #endif/* WAVELET2D_H */

    4,编写dll,可以使用3的方式,也可以编写def模块:

    LIBRARY 文件名字

           EXPORT "对外接口" @1

    5,两种方式使用其一就可以了。避免出现多种调用。

    转载请注明原文地址: https://ju.6miu.com/read-11642.html

    最新回复(0)