Dll调用能够返回执行结果,但提示invalid pointer operation错误
程序部分
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) lbl1: TLabel; lbl2: TLabel; Edt_Str: TEdit; Edt_Key: TEdit; lbl3: TLabel; Edt_CryptA: TEdit; btn1: TButton; btn2: TButton; lbl4: TLabel; Edt_CryptB: TEdit; lbl5: TLabel; Edt_StrA: TEdit; Edt_StrB: TEdit; lbl6: TLabel; procedure btn1Click(Sender: TObject); procedure btn2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; TKeyByte = array[0..5] of Byte; TDesMode = (dmEncry, dmDecry);var Form1: TForm1; function EncryStr(Str, Key: string): string;external 'Encypt.dll' name 'EncryStr'; function DecryStr(Str, Key: string): string;external 'Encypt.dll' name 'DecryStr'; function EncryStrHex(Str, Key: string): string;external 'Encypt.dll' name 'EncryStrHex'; function DecryStrHex(Str, Key: string): string;external 'Encypt.dll' name 'DecryStrHex';implementation{$R *.dfm}procedure TForm1.btn1Click(Sender: TObject);begin Edt_CryptA.Text:=EncryStr(Edt_Str.Text,Edt_Key.Text); Edt_CryptB.Text:=EncryStrHex(Edt_Str.Text,Edt_Key.Text);end;procedure TForm1.btn2Click(Sender: TObject);begin Edt_StrA.Text:=DecryStr(Edt_CryptA.Text,Edt_Key.Text); Edt_StrB.Text:=DecryStrHex(Edt_CryptB.Text,Edt_Key.Text);end;end.library Encypt;{ 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, Classes, DES in 'DES.pas';{$R *.res} exports EncryStr, DecryStr, EncryStrHex, DecryStrHex;beginend.