Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to use recompiled DLL?

Posted on 2005-04-28
7
Medium Priority
?
335 Views
Last Modified: 2010-04-16
I have an app that uses properties and function return values from certain
DLLs.  Each DLL returns the same thing but gets it in a different way.  An
abstract class is used to access the DLLs.

If I need to change code in one of the DLL methods, then recompile it, is
there a way to have the app use the recompiled DLL without shutting down?
What is the correct approach for this?

Thanks,
Brett

0
Comment
Question by:brettr
  • 4
  • 3
7 Comments
 

Author Comment

by:brettr
ID: 13894231
I'm thinking simply destroy the object referencing the DLL.  The broken reference will cause GC on the object and should release the DLL(?).  Then I
can create a new object to reference the DLL and begin calling methods from it.  Will this work?  What happens is code executing inside the DLL?  Will
it finish then the DLL is release?
0
 
LVL 17

Expert Comment

by:Jesse Houwing
ID: 13896524
In ordet to do this you will need to load the dll you want to dynamically re-load in a seperate app-domain. When you detect the dll has changed (through a filssystemlistener) you will have to destry teh app-domain in question, create a new appdomain and load the new dll in the new appdomain.
0
 

Author Comment

by:brettr
ID: 13896604
If I know when the DLL will be recompiled, can I just manually destroy/recreate it via a button click event rather than filesystemlistener?   The implementations would probably be the same, just different ways of doing it...right?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 17

Expert Comment

by:Jesse Houwing
ID: 13896637
That's right. The trick is in the extra applicationdomain, as you can only dynamically unload an appdomain, not a separate dll.
0
 

Author Comment

by:brettr
ID: 13896840
Ok.  Do you have any online references to app domains as they may relate to our discussion?
0
 
LVL 17

Accepted Solution

by:
Jesse Houwing earned 200 total points
ID: 13900231
0
 

Author Comment

by:brettr
ID: 13900472
Yep - I had already printed that one out.  Thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question