如何在应用程序中缓存Dll? [英] How Dll Caching in Application ?

查看:67
本文介绍了如何在应用程序中缓存Dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!!!

我在低负载形式的应用程序中使用组件.我想在C#中缓存dll?

hi !!!

I use component in application where low load form. I want to cache dll in C#??

推荐答案

该框架将通过在内存中加载任何dll来为您完成此操作.您完全不必担心这一点.
The framework will do this for you by loading any dll in memory. You need not worry about this at all.


您应该了解以下内容.本机可执行模块和.NET之间的区别是DLL在.NET上不是什么特别的东西,只是可以是任何东西的扩展名.同样,DLL和EXE之间也没有根本区别. EXE的唯一特殊功能是特殊的入口点(通常是主要").特别是,可以完全像使用DLL一样,将应用程序EXE文件作为另一个程序集中的程序集加载或引用(在某些情况下,它可以是一种有用的技术).反过来,具有特殊接口的实现的DLL可以在专用主机下用作EXE.

基本概念是.NET不是EXE或DLL,而是 assembly .诸如EXE或DLL之类的可执行模块称为模块. Visual Studio仅支持创建由单个(主)模块组成的程序集,可以通过.NET运行时库找到该程序集.当一个程序集加载有它直接或间接引用的所有程序集时,所有这些程序集都被加载到一个单独的process中,这对加载的程序集之间的边界几乎不敏感.如果在运行时通过System.Reflection.Assembly加载方法或CodeDOM在过程中动态加载程序集,则会发生相同的情况. (同时,对于每种方法,可以确定它在哪个程序集和模块中工作.)此外,除非创建了不同的应用程序域,否则所有这些程序集都将装入单个应用程序域(System.AppDomain).在运行时明确地显示.

所有这些都应说明,程序集之间的边界并不是那么重要(但是就权限而言,它们更为重要.)此外,最好了解这些方法不会立即加载到内存中.它们仅在每次调用时按需JIT编译到机器代码中.

—SA
You should understand the following. One difference between native executable modules and .NET is that a DLL is not anything special on .NET, just an extension which can be anything. Also, there is no fundamental difference between DLL and EXE. The only special feature of EXE is a special entry point (usually "main"). In particular, an application EXE file can be loaded or referenced as an assembly in another referenced assembly exactly as it is done with DLL (and it can be a useful technique in some cases). In turn, a DLL with an implementation of a special interface can be used as EXE under a specialized host.

The fundamental concept is .NET is not EXE or DLL but assembly. The executable modules like EXE or DLL are are called modules. Visual Studio only supports creation of an assembly consisting of a single (main) module which can be found via the .NET run-time library. When an assembly is loaded with all the assemblies it references directly or indirectly, all those assemblies are loaded in one single process which is nearly insensitive to the boundaries between loaded assemblies. Same thing happens if an assembly is loaded in the process dynamically during run-time via System.Reflection.Assembly loading methods or CodeDOM. (At the same time, for each method it is possible to determine in what assembly and module it is working.) More than that, all these assemblies are loaded is a single Application Domain (System.AppDomain) unless a different Application Domain is created explicitly during run time.

All that should explain that the boundaries between assemblies are not so essential (but they are much more important in terms of permissions.) Moreover, it is good to understand that the methods are not loaded in the memory immediately. They are JIT-compiled into the machine code only on demand, on per-call basis.

—SA


这篇关于如何在应用程序中缓存Dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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