为什么要使用DLL? [英] Why use DLLs?

查看:183
本文介绍了为什么要使用DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我对应用程序开发和

DLL的使用有疑问。因为我的EXE正在增长,我不确定是否应该将一些代码

放入DLL中。但是我应该把什么样的代码放在那里?在我的

unserstanding中,它只适用于不经常使用的代码。

这个大小有意义吗?

thx

Hi,

I have a question regarding Application Development and the usage of
DLLs. Because my EXE is growing I''m not sure if I should put some code
into a DLL. But what kind of code should I put there? In my
unserstanding it only make sense for code wich isn''t often used. At
which size does it make sense?
thx

推荐答案

Florian< ve ******@gmx.ch>写道:
Florian <ve******@gmx.ch> wrote:
我有一个关于应用程序开发和
DLL的使用的问题。因为我的EXE正在增长,我不确定是否应该将一些代码放入DLL中。但是我应该把什么样的代码放在那里?在我的
unserstanding中,它只适用于不经常使用的代码。

哪个大小有意义?
I have a question regarding Application Development and the usage of
DLLs. Because my EXE is growing I''m not sure if I should put some code
into a DLL. But what kind of code should I put there? In my
unserstanding it only make sense for code wich isn''t often used. At
which size does it make sense?




相反 - 库是*经常使用的代码的理想选择 -

由不同的应用程序。如果你有两个应用程序,其中两个应用程序想要使用一堆相同的类,你可以将这些类放在一个

库中,这两个应用程序都可以引用同一个图书馆。


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复小组,请不要给我发邮件



On the contrary - libraries are ideal for code which *is* often used -
by different applications. If you have two applications, both of which
want to use a bunch of the same classes, you can put those classes in a
library, and both applications can reference the same library.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


" Jon Skeet [C#MVP]" < SK *** @ pobox.com>写在

新闻:MP ************************ @ msnews.microsoft.c om ...
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in
news:MP************************@msnews.microsoft.c om...
Florian< ve ****** @ gmx.ch>写道:
Florian <ve******@gmx.ch> wrote:
我有一个关于应用程序开发和
DLL的使用的问题。因为我的EXE正在增长,我不确定是否应该将一些代码放入DLL中。但是我应该把什么样的代码放在那里?在我的
unserstanding中,它只适用于不经常使用的代码。

哪个大小有意义?
I have a question regarding Application Development and the usage of
DLLs. Because my EXE is growing I''m not sure if I should put some code
into a DLL. But what kind of code should I put there? In my
unserstanding it only make sense for code wich isn''t often used. At
which size does it make sense?



相反 - 库是* *经常使用的代码的理想选择 -
由不同的应用程序。如果你有两个应用程序,它们都想要使用一堆相同的类,你可以将这些类放在一个
库中,两个应用程序都可以引用同一个库。



On the contrary - libraries are ideal for code which *is* often used -
by different applications. If you have two applications, both of which
want to use a bunch of the same classes, you can put those classes in a
library, and both applications can reference the same library.

<除此之外,DLL还有助于构建应用程序:你可以单独开发和测试它们(可能也是由不同的人)。

维护通常也更容易,因为不同的

组件(DLL'和EXE')之间的责任更清晰。


并且,DLL'也经常用于可选的代码部分:如果某些功能只需要一些客户需要,那么你可以将它放入DLL中,并且(如果

动态加载DLL)只在那些需要
的PC上部署该DLL。


Niki



In addition to that, DLL''s also help structuring an application: You can
develop and test them separately (maybe by separate people, too).
Maintainance is also often easier, as responsibilities between different
assemblies (DLL''s and EXE''s) are clearer.

And, DLL''s are also often used for optional code parts: If a certain feature
is only needed by some of your customers, you can put it into a DLL, and (if
the DLL is loaded dynamically) deploy that DLL only on PCs where it''s
needed.

Niki


我的设计理念是,几乎所有代码都应该放在DLL中,并且

EXE将包含最少的逻辑。最好的EXE将只有一个简单的main

函数来处理命令行参数并将这些

信息传递给库中的类。


Niki Estner < NI ********* @ cube.net>在消息中写道

news:uE ************** @ TK2MSFTNGP12.phx.gbl ...
My design philosophy is that almost all code should go in a DLL and that the
EXE would contain minimal logic. The best EXE will have only a simple main
function that processes the commandline arguments and passes that
information to classes from the library.

"Niki Estner" <ni*********@cube.net> wrote in message
news:uE**************@TK2MSFTNGP12.phx.gbl...
" Jon Skeet [ C#MVP]" < SK *** @ pobox.com>在
新闻中写道:MP ************************ @ msnews.microsoft.c om ...
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in
news:MP************************@msnews.microsoft.c om...
Florian< ve ****** @ gmx.ch>写道:
Florian <ve******@gmx.ch> wrote:
我有一个关于应用程序开发和
DLL的使用的问题。因为我的EXE正在增长,我不确定是否应该将一些代码放入DLL中。但是我应该把什么样的代码放在那里?在我的
unserstanding中,它只适用于不经常使用的代码。
哪个大小有意义?
相反,库是不同应用程序*经常使用的代码的理想选择。如果你有两个应用程序,它们都想要使用一堆相同的类,你可以将这些类放在一个
库中,两个应用程序都可以引用同一个库。
I have a question regarding Application Development and the usage of
DLLs. Because my EXE is growing I''m not sure if I should put some code
into a DLL. But what kind of code should I put there? In my
unserstanding it only make sense for code wich isn''t often used. At
which size does it make sense?
On the contrary - libraries are ideal for code which *is* often used -
by different applications. If you have two applications, both of which
want to use a bunch of the same classes, you can put those classes in a
library, and both applications can reference the same library.

<除此之外,DLL还有助于构建应用程序:您可以单独开发和测试它们(也可能由不同的人员)。
维护也经常更简单,因为不同的程序集(DLL'和EXE')之间的职责更清晰。

并且,DLL'也常用于可选的代码部分:如果是某些客户只需要某个



In addition to that, DLL''s also help structuring an application: You can
develop and test them separately (maybe by separate people, too).
Maintainance is also often easier, as responsibilities between different
assemblies (DLL''s and EXE''s) are clearer.

And, DLL''s are also often used for optional code parts: If a certain



功能,你可以将它放入DLL中,并且
(如果动态加载DLL)只在PC上部署该DLL需要的地方。

Niki


feature is only needed by some of your customers, you can put it into a DLL, and (if the DLL is loaded dynamically) deploy that DLL only on PCs where it''s
needed.

Niki



这篇关于为什么要使用DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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