应用程序运行/执行期间Dll中的效果更改。 [英] Effect Change in Dll during Application running/execution.?

查看:146
本文介绍了应用程序运行/执行期间Dll中的效果更改。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,





在我的应用程序中,包含许多COM-Dll',我添加了新的类/接口/方法,显然,因为,IID-CLSID更改,我们需要使用RegSvr32.exeabc.dll注册Dllabc.dll,通过关闭Application的实例。(先决条件)并替换新注册的dll与旧的一样。



但是我的查询是,当应用程序运行时(没有关闭应用程序),是否可能影响上述场景。 ?



我的理解是,Dll(Com-dll)被加载到进程地址空间中的预定义基址,并且当它被添加了接口/方法时,这样的dll需要卸载并重新加载才能实现修改后的更改。



将接口/方法添加到COM-Dll运行是否可行申请实例?



详情:



VS 2008 IDE,Windows 7 o / s。



先谢谢,



问候,



VishaK_90

解决方案

作为一个快速回答,我会回答:最好忘记它。



但是,有一些与 System.Reflection.Emit 相关的远程可能性。您可以在运行时生成(发出)整个程序集并使用它。或者,您可以在运行时添加单独的方法,将其转换为委托实例并在运行时调用。请参阅:

http://msdn.microsoft.com /en-us/library/system.reflection.emit.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.reflection.emit.dynamicmethod.aspx [ ^ ]。



这些方法非常先进,并且在一些非常特殊的情况下使用。其中一个模型是序列化,它与数据类型无关。如果代码总是使用 System.Reflection 来深入研究每种类型并对其进行序列化,则会导致性能低下,只能用于非常小的对象图和数据量。使用 System.Reflection.Emit ,每种类型只执行一次反射,即时创建序列化代码,然后重复使用。



在所有这些技术中,只是调试发出的代码是一个问题。并且代码的发出......作为一个最低限度,它需要很好的CIL知识和对CLR功能的良好理解。



所以,我不会给你更多的细节在我能够理解你的目标并且看到你可以这样做之前。机会是,您可以设计更简单的架构。有些东西告诉我你还没有动态添加代码及其目的的精心构思。



-SA

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

解决方案

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


这篇关于应用程序运行/执行期间Dll中的效果更改。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆