全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1007
推到 Plurk!
推到 Facebook!

Dll無法在98環境載入

尚未結案
jimmyliu97
一般會員


發表:3
回覆:7
積分:2
註冊:2004-10-05

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-01-24 19:04:53 IP:61.219.xxx.xxx 未訂閱
請問一下 我的開發環境在2000pro Bcb6 我做了一個Dll去給程式呼叫,以動態的方式呼叫 我在2000環境執行是正常的,但是將程式複製到98環境時 卻變成載入Dll失敗,在LoadLibrary回傳NULL, 我確定有將相關的Dll一起複製過去,請問是什麼原因
jimmyliu97
一般會員


發表:3
回覆:7
積分:2
註冊:2004-10-05

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-02-01 11:41:57 IP:61.219.xxx.xxx 未訂閱
找了些文章  有提到要在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

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-02-02 16:34:04 IP:210.69.xxx.xxx 未訂閱
這個 DLL 確定可以在 Win98 上使用嗎 ?
------
能力不足,求助於人;有能力時,幫幫別人;如果您滿意答覆,請適時結案!

子曰:問有三種,不懂則問,雖懂有疑則問,雖懂而想知更多則問!
jimmyliu97
一般會員


發表:3
回覆:7
積分:2
註冊:2004-10-05

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-02-10 20:10:02 IP:219.84.xxx.xxx 未訂閱
是98不行 2000可以
jimmyliu97
一般會員


發表:3
回覆:7
積分:2
註冊:2004-10-05

發送簡訊給我
#5 引用回覆 回覆 發表時間:2005-02-10 20:13:46 IP:219.84.xxx.xxx 未訂閱
B.dll 是我自己寫的 A.dll 是別人寫的我直接呼叫 在98呼叫 B不行 A卻可以
rogan321
高階會員


發表:21
回覆:307
積分:200
註冊:2003-05-15

發送簡訊給我
#6 引用回覆 回覆 發表時間:2005-02-12 01:32:42 IP:203.204.xxx.xxx 未訂閱
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
系統時間:2024-05-05 5:17:06
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!