我写了一个DLL,并在程序中调用
结果出现了图例 http://be10.ods.org/hyd/3.JPG
"invalid pointer operation"
看了一些资料说在单元里加上SHARMEM就可以了。
结果一运行程序就出错
图例 1 http://be10.ods.org/hyd/1.JPG
     2 http://be10.ods.org/hyd/2.JPG搞不懂得什么原因? 我当时在另一个程序中调用DLL都没发现这个问题。
出现这种原因到底是什么问题 
DLL源代码如下

library Project3;{ 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  SysUtils,
  Classes;{$R *.res} function Decrypt(s: string; Key: Integer = 27): string;  export;
var
  i: Integer;
begin
  Result := s;
  for i := 1 to Length(s) do
    Result[i] := Chr(Ord(s[i]) xor Key);
end;    function Encrypt(s: string; Key : Integer =27): string; export;begin
  Result := Decrypt(s, Key);
end;
exports
decrypt ,encrypt;begin
end.