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

dll 內可否 release Host Application 內的 memory

答題得分者是:william
dan59314
中階會員


發表:121
回覆:107
積分:86
註冊:2002-08-16

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-08-21 15:58:51 IP:211.23.xxx.xxx 未訂閱
請問各位先進, 我在 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

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-08-26 09:00:46 IP:211.23.xxx.xxx 未訂閱
有人可以幫我解惑嗎? :) 軟還要更軟,我的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

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-08-26 09:52:04 IP:147.8.xxx.xxx 未訂閱
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

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-08-26 11:13:22 IP:211.23.xxx.xxx 未訂閱
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

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-08-26 11:41:17 IP:147.8.xxx.xxx 未訂閱
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

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