“如果DLL中用到了DELPHI的string类型,则DLL和主程序中都需要加上ShareMem”。DLL项目加ShareMem这个我知道,但主程序中也要加?这我就不明白了,为什么以前不加的时候没这个问题呢?加就加吧,果然加上后一点问题都没有。唉,真是搞不明白。最后在新建DLL项目时,DELPHI有一段注释给了我答案。

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
  ShareMem,
  SysUtils,
  Controls,
  Forms;

{$R *.res}

begin

end.

http://blog.csdn.net/hhf383530895/archive/2009/11/24/4861309.aspx

最新文章

  1. php数字补零的两种方法
  2. mongod 命令执行发现已经有进程在运行mongod数据库--errno:48 Address already in use for socket: 0.0.0.0:27017
  3. HDU-1438 钥匙计数之一
  4. simulate windows postmessage or keydown
  5. Path Sum,Path Sum II
  6. UVA 1386 - Cellular Automaton(循环矩阵)
  7. 1602: [Usaco2008 Oct]牧场行走
  8. 16.如何做到webpack打包vue项目后,可以修改配置文件
  9. [Android FrameWork 6.0源码学习] LayoutInflater 类分析
  10. 学号 20175223 《Java程序设计》第4周学习总结
  11. iOS开发-适配器和外观模式
  12. 分享url带中文参数,打开html操作完毕跳转jsp页面中文乱码解决
  13. 秒杀多线程第五篇 经典线程同步 关键段CS
  14. 利用nexus5伪造一张门禁卡
  15. Python locals() 函数
  16. 在Linux上自动调整屏幕亮度保护眼睛
  17. bzoj2669-局部极小值
  18. final修饰的变量是引用不能改变还是引用的对象不能改变
  19. vue项目引入第三方js插件,单个js文件引入成功,使用该插件方法时报错(问题已解决)
  20. 最大子段和问题(dp)

热门文章

  1. linux_1
  2. archlinux alsa安装,音量设置和音量信息保存
  3. docker-compose volumes指令路径映射问题
  4. docker系列之网络配置
  5. Shell中各种括号的作用
  6. RESTful API批量操作的实现
  7. 排序算法C语言实现——快速排序的递归和非递归实现
  8. PHP获得网页源码
  9. tomcat 修改默认端口8080 为 80端口
  10. 17,时间模块 time,random模块