« on: December 18, 2023, 07:47:50 pm »
I think it would be useful to add a directive so FPC compiler understands/crossplatforminterprets and reminds what libraries symbol to refer without the need to repeat it in source code
unit myimports;
{$mode ObjFPC}{$H+}
interface
const
MyLibrary = 'mylibname' +
{$ifdef WINDOWS}
'.dll'
{$else}
{$ifdef DARWIN}
'.dylib'
{$else}
'.so'
{$endif}
{$endif};
procedure proc1; external MyLibrary;
procedure proc2; external MyLibrary;
procedure proc3; external MyLibrary;
...
procedure procN; external MyLibrary;
implementation
end.
should be replaced by
unit myimports;
{$mode ObjFPC}{$H+}
interface
{$DYNLIB mylibname}
procedure proc1; external;
procedure proc2; external;
procedure proc3; external;
...
procedure procN; external;
implementation
end.
with a new compiler directive like {$dynlib name} (unit scope or block of externals scope automatycally adjusting platforms naming conventions for all the following 'external' with no name mentioned
« Last Edit: December 18, 2023, 07:55:40 pm by mercurhyo »
Logged
DEO MERCHVRIO - Linux, Win10pro - Ryzen9XT 24threads + Geforce Rtx 3080SUPRIM
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld