我需要将我的部分 Win32 Delphi 应用程序提供给另一家公司的 Linux gcc 程序。
吞吐量和部署要求使任何类型的远程服务都不合适,因此我正在考虑使用 FreePascal 构建 gcc 应用程序可以调用的 .SO(Linux 等效的 DLL)。
自从我使用 C/C++ 并且从未在 Linux 上使用过很长时间了,所以我有点不确定如何最好地构建 DLL/SO 接口以与 gcc 调用者兼容。
这是我的数据结构的表示
TFoo = record
x, y : double;
a : smallint;
b : string;
end;
TBar = record
a : double;
b : longint;
c : string;
end;
TFooBar = record
foo : array of TFoo;
bar : array of TBar;
end;
procedure Process(const inFooBar : TFooBar);
要通过 FreePascal 使此 Process 方法在外部可用。所以我需要如何修改这些声明?我在想一些事情
TFoo = record
x, y : double;
a : smallint;
b : PChar;
end;
TBar = record
a : double;
b : longint;
c : PChar;
end;
TFooBar = record
foo : ^TFoo;
foo_count : longint;
bar : ^TBar;
bar_count : longint;
end;
procedure Process(const inFooBar : TFooBar);
我在正确的轨道上吗?我不必完全正确,其他公司的程序员很可能会纠正我的错误。我只是不想让他们看到我发给他们的东西时笑得太厉害。