IDE:Delphi 10.3.3
Linux桌面系统:Deepin20
一.编写SO库
新建一个项目
项目右键Add Linux Platform
然后项目就变为.so
添加代码
library mySO;
uses
System.SysUtils,
System.Classes;
{$R *.res}
function testStr: TStringList; cdecl;
var
str: string;
strlist: TStringList;
begin
strlist := TStringList.Create;
strlist.Add('hello');
strlist.Add('world');
result := strlist;
end;
function testInt(i: Integer): Integer; cdecl;
begin
Inc(i);
result := i;
end;
exports
testInt,
testStr;