やじゅ@アプリケーション・ラボ わんくま支局

目次

Blog 利用状況

ニュース

プロフィール

MSMVP

.Netにおける、動的DLLの解放について

ごくたまに、@ITでも回答するようになったのですが、この質問者さんは結果をきちんと返して頂いたので好感がもてます。

件名:動的DLLの解放について
http://www.atmarkit.co.jp/bbs/phpBB/viewtopic.php?topic=46665&forum=7
【質問内容】
①EXEを実行(EXEは24h常駐です。)
②動的にDLLをロード・実行し、DLLの処理終了(EXEは終了しない。)
③DLLのPGを改訂し、実行環境にコピーすると、エラーMSGがでる。
 「○○.dllをコピーできません。他の人またはプログラムによって使用され
ています。ファイルを使用している可能性があるプログラムを全て閉じてから、やり直してください。」

EXEを24h常駐させ、実行条件によって、ロードするDLLを変更したいと考えています。

【回答】
.NETでは、Win32の時のFreelibrary関数(DLLを呼び出しプロセスの アドレス空間から切り離す)のようなものはなく、一旦DLLを ロードしたらプロセスを終了するまでメモリに残り続けます。
(通常のDefault AppDomainにロードされている場合において)



あえて、動的にする場合は、CreateDomainにて、User AppDimainを作成し、そこにアセンブリをロードして実行、終了時にAppDimainをUnloadすることで、動的にアセンブリを解放することが出来るようになります。

投稿日時 : 2008年10月10日 2:23

コメントを追加

# re: .Netにおける、動的DLLの解放について 2008/10/11 13:41 通りすがり

ロード中のアセンブリの入れ替えが目的ならシャドウコピーでいいような気がしますが、質問者さんのシステム詳細は不明なのでどうなんでしょう。
http://msdn.microsoft.com/ja-jp/library/ms404279.aspx

# re: .Netにおける、動的DLLの解放について 2008/10/11 19:05 やじゅ

なるほどASP.NETなら、シャドウコピーが出来るんですね。
質問者さんのシステムは不明ですが、私には参考になりました。

モジュールの入れ替えについて
http://www.atmarkit.co.jp/bbs/phpBB/viewtopic.php?topic=28589&forum=7

# re: .Netにおける、動的DLLの解放について 2008/10/12 15:50 通りすがり

例としてASP.NET サイトのようなとは書いてありますが、WinFormのクラサバでもいけますよ。
クラサバは稼動中にアセンブリを入れ替えることは少ないですが、WCFのホストなんかは使ったりすると思います。
ただ参照設定ではなく、リフレクション等で動的に読み込む事を前提で作ってあるアプリなんかだと難しいでしょうね。

# re: .Netにおける、動的DLLの解放について 2008/10/12 18:34 やじゅ

>WinFormのクラサバでもいけますよ。
了解

C# DLLの動的読み込み
http://d.hatena.ne.jp/akiramei/20071111

# doxycycline vibramycin https://doxycyline1st.com/
doxycycline 500mg 2022/02/26 20:02 Doxycycline

doxycycline vibramycin https://doxycyline1st.com/
doxycycline 500mg

# rgjonvnjtysb 2022/06/15 2:43 gccknwic

cheapest plaquenil online https://hydroxychloroquinex.com/

# ed drug prices https://erectionpills.best/
best ed treatment 2022/06/28 19:51 ErectionPills

ed drug prices https://erectionpills.best/
best ed treatment

# best non prescription ed pills https://withoutprescription.store/
non prescription erection pills 2022/07/03 3:31 CanadaRx

best non prescription ed pills https://withoutprescription.store/
non prescription erection pills

# 200 mg prednisone daily https://prednisone20mg.icu/ 2022/10/15 13:20 Prednisone

200 mg prednisone daily https://prednisone20mg.icu/

# tinder online https://topdatingsites.fun/
sabrina carpenter dating 2022/11/15 0:26 DatingTop

tinder online https://topdatingsites.fun/
sabrina carpenter dating

# prednisone over the counter uk https://prednisonepills.site/
1 mg prednisone daily 2022/11/28 23:51 Prednisone

prednisone over the counter uk https://prednisonepills.site/
1 mg prednisone daily

# plentyoffish dating sites https://datingsiteonline.site/
dating wites 2022/12/05 23:46 Tading

plentyoffish dating sites https://datingsiteonline.site/
dating wites

# Actual trends of drug. Medicament prescribing information.
https://edonlinefast.com
Learn about the side effects, dosages, and interactions. Get warning information here. 2023/02/17 20:00 EdOnline

Actual trends of drug. Medicament prescribing information.
https://edonlinefast.com
Learn about the side effects, dosages, and interactions. Get warning information here.

# ブランドN級品通販 2023/03/21 17:28 aufvfg@msn.com

迅速な対応して頂ける良いお店です。
又、機会があれば利用させて頂きます。
ありがとうございました。
★ルイヴィトン★モノグラム★パピヨン30(大)★ハンドバッグ★ポーチ付★M51365★旧型タイプ★
ありがとうございました。
商品届きました、とても迅速な対応ありがとうございました。
思った通りのカバンで嬉しい限りです。
又、購入の際は、宜しくお願い致します。
ブランドN級品通販 https://www.gmt78.com/product/detail/103.htm

# where to get cytotec pills - https://cytotecsale.pro/# 2023/04/28 23:29 Cytotec

where to get cytotec pills - https://cytotecsale.pro/#

# ed treatment review https://edpills.tech/# ed medications 2023/12/23 4:40 EdPills

ed treatment review https://edpills.tech/# ed medications

タイトル
名前
URL
コメント