我在dll中使用String 类型,但是没有引用ShareMem单元,却能正常运行,没有出现类似内存出错的错误。
为什么不会出现错误?
为什么不会出现错误?
解决方案 »
- ???当表T1结构发生变化时,如何升级原表到现结构???
- 请教:如何通过232通信方式同步2台或多台电脑的SQL数据库?实现互相备份数据的功能,谢谢!
- socket向服务器传送一个大概10K足有的文件....
- 既能左右居中,又能上下居中,而且还支持换行的控件,有吗?
- 如何用delphi实现导入导出sql2000里的某些表的数据
- Findwindow函数如何用
- sql请教???
- 求救:Delphi+sql server开发一个管理系统,三个以上用户,速度极慢,有什么办法解决
- 像金山毒霸那种拉窗帘式的更换窗口的方式怎么样实现?
- 如何得到我的密码?
- 怎样比较一个数据是否存在于一数组中?
- 如何自动拨号
哈哈~换一台没有装delphi的机器上去
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.}
已经说的很清楚了,如果的导出函数中参数或返回值有string类型,那么就需要引用ShareMem
至于你dll内部使用string类型跟引不引用ShareMem没关系,ShareMem只是解决dll中直接与外界
发生交互的string变量内存管理问题,比如何时释放啊该不该释放....
Q: How do I get my DLL and main application to share FastMM so I can safely pass long strings and dynamic arrays between them?
A: The easiest way is to define ShareMM, ShareMMIfLibrary and AttemptToUseSharedMM in FastMM4.pas and add FastMM4.pas to the top of the uses section of the .dpr for both the main application and the DLL.