dll 內可否 release Host Application 內的 memory |
答題得分者是:william
|
dan59314
中階會員 發表:121 回覆:107 積分:86 註冊:2002-08-16 發送簡訊給我 |
請問各位先進, 我在 Host Application 內有一個 link list,可否在 dll 內 release 該 link list 的空間? 我在 dll 內以 var 傳入host application 的鏈串列 head, tail,可是 dispose 時卻出現 記憶體存取錯誤的訊息,為什麼呢? 軟還要更軟,我的Artwork
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=27674 Chinese Girl in Rhino3D
http://rhino3d.com/gallery/figure/girl.htm
|
dan59314
中階會員 發表:121 回覆:107 積分:86 註冊:2002-08-16 發送簡訊給我 |
|
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
You need to pass the Application global variable from your host application to your dll. And use the unit ShareMem in both projects as the very first unit. Something like the following in your dll:
procedure Setup(const App: TApplication); stdcall; begin Application := App; end;I think you would better restore back the Application variable when your dll is being unloaded (althoug it should be nil?). |
dan59314
中階會員 發表:121 回覆:107 積分:86 註冊:2002-08-16 發送簡訊給我 |
Thanks to William, it works. :) Further more, I add only ShareMem in both the use lists, but not to SetUp the application in the host application. It still works. What'are the differences between setting up and not setting up the application? 軟還要更軟,我的Artwork
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=27674 Chinese Girl in Rhino3D
http://rhino3d.com/gallery/figure/girl.htm
|
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
Perhaps this could help? http://delphi.ktop.com.tw/topic.php?TOPIC_ID=35228 Setting Application is mainly for VCL related stuff since VCL relies heavily on this variable. Anyway if you want to use VCL inside your dll, I would suggest using (runtime) package...
|
dan59314
中階會員 發表:121 回覆:107 積分:86 註冊:2002-08-16 發送簡訊給我 |
引言: Perhaps this could help? http://delphi.ktop.com.tw/topic.php?TOPIC_ID=35228 Setting Application is mainly for VCL related stuff since VCL relies heavily on this variable. Anyway if you want to use VCL inside your dll, I would suggest using (runtime) package...Much thanks to william. 軟還要更軟,我的Artwork http://delphi.ktop.com.tw/topic.php?TOPIC_ID=27674 Chinese Girl in Rhino3D http://rhino3d.com/gallery/figure/girl.htm |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |