在你的程序中加ShareMem单元
-------------------------------
The shared-memory managerTopic group See also
-------------------------------
If a DLL exports routines that pass long strings or dynamic arrays as parameters or function results (whether directly or nested in records or objects), then the DLL and its client applications (or DLLs) must all use the ShareMem unit. The same is true if one application or DLL allocates memory with New or GetMem which is deallocated by a call to Dispose or FreeMem in another module. ShareMem should always be the first unit listed in any program or library uses clause where it occurs.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.

解决方案 »

  1.   

    没有这么复杂。原因是DLL返回的是String类型,这不行。String是自管理型
    类型。你用PChar试试。如果非要用string型也可,用变参。
      

  2.   

    barton说的对,是内存的问题.
    不妨把你的DLL中函数改成返回BOOL类型,用来判断是否执行成功.
    身份证号码中的日期作为一个变参传入.内存在你的主程序中分配和释放,
    这样方便一些.
      

  3.   

    十有八九是因为你的DLL里封装的函数没有声明为stdcall