以下是建立DLL时的一个注意事项: 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. 这个问题我也碰到过,不过很容易解决,按以下的方法就可以了!! 共有三种解决问题的方法(可任选择一种): (1)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. 如果你的DLL对外输出了以字符串作参数类型或返回值类型的过程或方法,ShareMem这个单元就必须包含在DLL库源文件和调用该DLL的工程源文件的uses子句中,并且一定要作为第一个被引用的单元。 (2)To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters. 为了避免调用BORLANDMM.DLL,使用PChar或者ShortString传递字符串信息 (3)静态调用改为动态调用!
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. 这个问题我也碰到过,不过很容易解决,按以下的方法就可以了!!
共有三种解决问题的方法(可任选择一种):
(1)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.
如果你的DLL对外输出了以字符串作参数类型或返回值类型的过程或方法,ShareMem这个单元就必须包含在DLL库源文件和调用该DLL的工程源文件的uses子句中,并且一定要作为第一个被引用的单元。
(2)To avoid using BORLNDMM.DLL, pass string information using PChar or ShortString parameters.
为了避免调用BORLANDMM.DLL,使用PChar或者ShortString传递字符串信息
(3)静态调用改为动态调用!
最好贴出代码
现在已经好了。但我不知道如何好的。