//inte***ce.h檔案內容如下:
#pragma once
#include
//function point demo
#define isourcompanykey "isourcompanykey"
typedef int (winapi* isourcompanykey) (void);
class bluebottle
public:
bluebottle(lpcstr szdllpath) : m_hmodule(null)
m_hmodule = loadlibrarya(szdllpath);
~bluebottle()
if(m_hmodule)
freelibrary(m_hmodule);
m_hmodule = null;
farproc getfunc(lpcstr szfuncname)
if(m_hmodule)
return getprocaddress(m_hmodule, szfuncname);
return null;
protected:
hmodule m_hmodule;
//呼叫過程如下
#include
#include
#include
#include "inte***ce.h"
//dll name
#define dllname _t("verify.dll")
bool main(int argc, pchar argv)
_tprintf(_t("test called dll's function./n"));
int32 ui32ret = -1;
bluebottle pingzi(dllname);
isourcompanykey pfnourkey = null;
pfnourkey = (isourcompanykey)pingzi.getfunc(isourcompanykey);
if (null == pfnourkey)
_tprintf(_t("get dll's functions point error."));
return false;
ui32ret = pfnourkey();
_tprintf(_t("isourcompanykey's ret code:%d/nover"), ui32ret);
return true;
靜態載入dll和動態載入dll
一,首先編寫dll 建win32空dll工程 標頭檔案.h extern c declspec dllexport int max int a,int b extern c 解決函式名由於不同編譯器造成的名字匹配問題,通常c 編譯器編譯時會對函式進行改名,而c編譯器不會 extern c decls...
靜態載入dll和動態載入dll
一,首先編寫dll 建win32空dll工程 標頭檔案.h extern c declspec dllexport int max int a,int b extern c 解決函式名由於不同編譯器造成的名字匹配問題,通常c 編譯器編譯時會對函式進行改名,而c編譯器不會 extern c decls...
VC靜態載入DLL和動態載入DLL
a.dll 和a.lib 兩個檔案都有的話可以用靜態載入的方式 message 函式的宣告你應該知道吧,把它的宣告和下面的語句寫到乙個標頭檔案中 pragma comment lib,a.lib 然後你的對話方塊 cpp 中包含這個標頭檔案就可以使用 message 函式了。如果dll 沒有對應的 ...