本文實例講述了VC創建DLL動態鏈接庫的方法。分享給大家供大家參考。具體實現方法如下:
頭文件中聲明 t.h
#ifdef DLL_API #else#define DLL_API extern "C" _declspec(dllimport)#endifDLL_API int a(int cnt);DLL_API int b(int cnt);
.h文件引入
#define DLL_API extern "C" _declspec(dllexport)#include "t.h"
cpp文件中寫函數體
#define DLL_API extern "C" _declspec(dllexport)#include "t.h"int a(int cnt){return cnt+1;}int b(int cnt){return cnt+10;}
希望本文所述對大家的VC程序設計有所幫助。
新聞熱點
疑難解答
圖片精選