Delphi调用Dll出现错误:EInvalid pointer 的解决方法
(2012-05-24 15:24:26)
标签:
dlldelphiit |
分类: 编程资料 |
出现此问题,一般是传递了一字符串或动态数组给dll引起的。
Delphi的联机帮助解释如下:
ShareMem is the interface unit for the BORLANDMM.DLL memory manager, which allows modules to share dynamically allocated memory. BORLANDMM.DLL must be deployed with applications and DLLs that use ShareMem. When an application or DLL uses ShareMem, its memory manager is replaced by the memory manager in BORLANDMM.DLL.
Note
Linux uses glibc's malloc to manage shared memory.
windows下,uses ShareMem即可解决此问题,加的位置必须注意,否则会出错!调用dll的主程序,加在工程主文件的uses的第一句,必须是第一句,Dll也是一样,类似:
program project1;
uses