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;
begin
end.
编译,生成.so文件<

本文介绍了如何使用Delphi 10.3.3在Linux Deepin20系统上创建SO库及如何在新项目中调用该库。详细步骤包括新建项目、添加Linux平台、编写代码并编译生成.so文件,以及新项目中引入SO库并运行示例。
最低0.47元/天 解锁文章
1025

被折叠的 条评论
为什么被折叠?



