Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET3.5 ATL COM DLL
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 ?
 
Details:
 
VS 2008 IDE, Windows 7 o/s.
 
Thanks in Advance,
 
Regards,
 
VishaK_90
Posted 10-Apr-13 5:19am
Comments
Sergey Alexandrovich Kryukov at 10-Apr-13 10:31am
   
Why?
—SA

1 solution

Rate this: bad
good
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:
http://msdn.microsoft.com/en-us/library/system.reflection.emit.aspx[^],
http://msdn.microsoft.com/en-us/library/system.reflection.emit.dynamicmethod.aspx[^].
 
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.
 
—SA
  Permalink  
v2

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

  Print Answers RSS
0 Kornfeld Eliyahu Peter 275
1 Maciej Los 204
2 Sergey Alexandrovich Kryukov 200
3 King Fisher 185
4 OriginalGriff 183
0 OriginalGriff 6,223
1 DamithSL 4,724
2 Maciej Los 4,196
3 Kornfeld Eliyahu Peter 3,894
4 Sergey Alexandrovich Kryukov 3,496


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 10 Apr 2013
Copyright © CodeProject, 1999-2014
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