Dll無法在98環境載入 |
尚未結案
|
jimmyliu97
一般會員 發表:3 回覆:7 積分:2 註冊:2004-10-05 發送簡訊給我 |
|
jimmyliu97
一般會員 發表:3 回覆:7 積分:2 註冊:2004-10-05 發送簡訊給我 |
找了些文章
有提到要在98環境下使用,可能要在98的環境底下產生檔案才能使用
我測試過還是有問題,後來我發現好像是我產生出來的dll有問題
主程式以同樣的方式去呼叫別的B.dll,就沒有問題,呼叫A.dll就不行
B.dll不是我做的 主程式呼叫A.Dll,A.dll內容是呼叫另一個B.dll A.Dll內容如下
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason,void*)
{
return 1;
} void __stdcall System_Action(AnsiString action_type)
{
HINSTANCE Mydll;
typedef (*LOCK_98)(void);
LOCK_98 Power_Lock; Mydll=LoadLibrary("B.dll");
if(Mydll!=NULL)
{
Power=(LOCK_98)GetProcAddress(Mydll, "Power_Lock");
if(Power_Lock==NULL)
{
ShowMessage("Error GetProcAddress Power_Lock");
}
}
else
{
ShowMessage("Error LoadLibrary");
} Power_Lock();
} 紅色是一直行就會秀出的訊息
請各位看看是哪出了問題... 萬分感謝 先預祝各位新年快樂 ^^
|
pcboy
版主 發表:177 回覆:1838 積分:1463 註冊:2004-01-13 發送簡訊給我 |
|
jimmyliu97
一般會員 發表:3 回覆:7 積分:2 註冊:2004-10-05 發送簡訊給我 |
|
jimmyliu97
一般會員 發表:3 回覆:7 積分:2 註冊:2004-10-05 發送簡訊給我 |
|
rogan321
高階會員 發表:21 回覆:307 積分:200 註冊:2003-05-15 發送簡訊給我 |
Hi~jimmyliu97
我蠻好奇的~在2K真的可以正常運作嗎?
你的System_Action(AnsiString action_type)方法可以正確呼叫嗎?
有用到AnsiString應該要export MEMMGR.LIB和加入BORLNDMM.DLL
還有System_Action()應該是用來外部呼叫的函式吧?
那改成
void __export System_Action(AnsiString action_type)(3版的用法不確定是否可於6版使用)
或
void __declspec(dllexport) __stdcall System_Action(AnsiString action_type)
看看
有使用String類別,請參考這篇說明:
// Important note about DLL memory management when your DLL uses the
// static version of the RunTime Library:
//
// If your DLL exports any functions that pass String objects (or structs/
// classes containing nested Strings) as parameter or function results,
// you will need to add the library MEMMGR.LIB to both the DLL project and
// any other projects that use the DLL. You will also need to use MEMMGR.LIB
// if any other projects which use the DLL will be performing new or delete
// operations on any non-TObject-derived classes which are exported from the
// DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
// EXE's to use the BORLNDMM.DLL as their memory manager. In these cases,
// the file BORLNDMM.DLL should be deployed along with your DLL.
//
// To avoid using BORLNDMM.DLL, pass string information using "char *" or
// ShortString parameters.
//
// If your DLL uses the dynamic version of the RTL, you do not need to
// explicitly add MEMMGR.LIB as this will be done implicitly for you
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |