Click here to Skip to main content
13,045,285 members (63,780 online)
Rate this:
Please Sign up or sign in to vote.
Hi All,

In my Application, comprising many COM-Dll's, I had added new class/interface/method, obviously, since, IID-CLSID changes, we need to register the Dll "abc.dll" using RegSvr32.exe "abc.dll", by closing the instance of Application.(pre-requisite) and replacing the newly registered dll's with the old one.

But my query, is it possible to effect the above scenario when Application is running(without the application been closed). ?

my understanding is, the Dll (Com-dll) is loaded at predefined base address in process address space, and when it is subjected to addition of interfaces/method, such dll needs to be un-loaded and re-loaded again to effect the modified change.

Is it feasible to add interface/method to COM-Dll for running instance of Application ?


VS 2008 IDE, Windows 7 o/s.

Thanks in Advance,


Posted 10-Apr-13 4:19am
Sergey Alexandrovich Kryukov 10-Apr-13 10:31am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

As a quick answer, I would answer: better forget it.

However, there are couple of remote possibilities related to System.Reflection.Emit. You can generate (emit) a whole assembly during runtime and use it. Alternatively, you can add a separate method during run-time, convert it to a delegate instance and call during runtime. Please see:[^],[^].

Those approaches are very advanced and are used in some very special cases. One of such models is serialization, which is agnostic to the data types. If the code always uses System.Reflection to dig into each type and serialize it, it results in low performance, only acceptable for pretty small object graphs and volume of data. With System.Reflection.Emit, the reflection is performed only once per type, to serialization code is created on the fly and later reused.

In all those techniques, just the debugging of emitted code is a problem. And the emitting of the code… as a bare minimum, it requires good knowledge of CIL and good understanding of CLR functioning.

So, I would not give you more detail before I can understand your goals and see that you can go this way. Chances are, you can devise much simpler architecture. Something tells me that you don't yet have the elaborate conception of adding the code dynamically and its purpose.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 10 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100