[問題] GetProcAddress與namespace
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) c++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question): 使用GetProcAddress無法抓到正確的函式位址
餵入的資料(Input):
預期的正確結果(Expected Output): result=-151
錯誤結果(Wrong Output): result=NULL
程式碼(Code):(請善用置底文網頁, 記得排版)
//呼叫dll
typedef int (*testonly)(int);
int main()
{
testonly result ;
HINSTANCE hLibrary = LoadLibrary("IntimeDllCpp.dll");
if(hLibrary)
{
result = (testonly)GetProcAddress(hLibrary, "IntimeDllCpp::CGMCU::GetMode");
if(result)
{
std::cout << result(0) << std::endl;
}
FreeLibrary(hLibrary);
}
else
{
std::cout << "Failed To Load Library" << std::endl;
}
system("pause");
return 0;
}
//dll函式
namespace IntimeDll2UI
{
public ref class CGMCU //A00254 104.03.19
{
public:
LONG GetMode(LONG iIndex);
};
}
補充說明(Supplement): 請問一下因為我的函式在namespace下,該如何
設定GetProcAddress內的參數呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 219.87.179.165
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1446696347.A.ECC.html
※ 編輯: newlymoon (219.87.179.165), 11/05/2015 12:07:25
※ 編輯: newlymoon (219.87.179.165), 11/05/2015 12:08:08
→
11/05 12:49, , 1F
11/05 12:49, 1F
→
11/05 12:50, , 2F
11/05 12:50, 2F
推
11/05 13:08, , 3F
11/05 13:08, 3F
→
11/05 13:09, , 4F
11/05 13:09, 4F
→
11/05 13:15, , 5F
11/05 13:15, 5F
推
11/05 13:21, , 6F
11/05 13:21, 6F
→
11/05 13:24, , 7F
11/05 13:24, 7F
→
11/05 13:27, , 8F
11/05 13:27, 8F
→
11/05 20:51, , 9F
11/05 20:51, 9F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章