一、调用代码
Delphi版本Delphi 10 Seattle
Delphi代码
unit Unit1;
interface
function testint(i: Integer): Integer; stdcall;
function testpchar(value: PAnsiChar): PAnsiChar; stdcall;
implementation
function testint(i: Integer): Integer; stdcall;
begin
result := i + 1000;
end;
function testpchar(value: PAnsiChar): PAnsiChar; stdcall;
var
svalue: string;
begin
svalue := Utf8ToAnsi(value);
svalue := '你好:' + svalue;
result := PAnsiChar(AnsiToUtf8(svalue));
end;
end.
library test;
{ 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 thos