DLL是Dynamic Link Library(动态链接库)的缩写形式。DLL 是一个包含可由多个程序同时使用的代码和数据的库,DLL不是可执行文件,动态链接提供了一种方法,使进程可以调用不属于其可执行代码的函数,函数的可执行代码位于一个 DLL 中,该 DLL 包含一个或多个已被编译、链接并与使用它们的进程分开存储的函数。DLL 还有助于共享数据和资源,多个应用程序可同时访问内存中单个DLL 副本的内容,DLL 是一个包含可由多个程序同时使用的代码和数据的库。
Delphi编写DLL
library MyDLL;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes;
{$R *.res}
//function MyS

这篇博客详细介绍了如何使用Delphi编写DLL,并展示了静态和动态两种方式调用DLL的方法。通过示例代码,解释了DLL的作用、内存管理和如何在Delphi中导出函数,以及静态加载和动态加载的优缺点。

1686

被折叠的 条评论
为什么被折叠?



