function aa( outstr: PChar ): Boolean; stdcall; var straa: string; //必须通过局部变量中转,不能直接使用var参数 begin Result := False; straa := 'abcd'; Move(straa[1], outstr^, Length(straa)); Result := True; end; 调用: function aa(var outstr: string ): Boolean; var buffer: array[0..MAX_PATH-1] of char; begin FillChar(buffer, MAX_PATH, 0); Result := Taa(funcaa)(buffer); outstr := buffer; end;