mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 14:48:18 +02:00

on current fpc versions and linux always against glibc, so the shared library handling is tested
64 lines
1.3 KiB
ObjectPascal
64 lines
1.3 KiB
ObjectPascal
{ %NEEDLIBRARY }
|
|
{ %skiptarget=$nosharedlib }
|
|
{ %delfiles=tweaklib1 }
|
|
|
|
{$if defined(Unix) and not defined(aix)}
|
|
{$define supported}
|
|
{$endif Unix}
|
|
{$ifndef fpc}
|
|
{$define supported}
|
|
{$endif}
|
|
|
|
{$ifdef supported}
|
|
|
|
{$if (FPC_FULLVERSION<=30301) and defined(linux)}
|
|
uses
|
|
initc;
|
|
{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
|
|
|
|
const
|
|
{$ifdef windows}
|
|
libname='tweaklib1.dll';
|
|
{$else}
|
|
libname='tweaklib1';
|
|
{$linklib tweaklib1}
|
|
{$endif}
|
|
|
|
var
|
|
{$ifndef darwin}
|
|
_myvar: cardinal; weakexternal libname name '_MYVAR';
|
|
_myvar2: cardinal; weakexternal libname name '_MYVAR2';
|
|
{$else darwin}
|
|
{ needs to be fixed in the compiler }
|
|
_myvar: cardinal; weakexternal libname name 'MYVAR';
|
|
_myvar2: cardinal; weakexternal libname name 'MYVAR2';
|
|
{$endif darwin}
|
|
|
|
function _test: cardinal; weakexternal libname name '_TEST';
|
|
|
|
procedure _test2; weakexternal libname name '_TEST2';
|
|
|
|
begin
|
|
{$ifdef darwin}
|
|
if (paramcount=0) then
|
|
halt(0);
|
|
{$endif}
|
|
if not assigned(@_test) then
|
|
halt(1);
|
|
if assigned(@_test2) then
|
|
halt(2);
|
|
if _test<>$facef00d then
|
|
halt(3);
|
|
if not assigned(@_myvar) then
|
|
halt(4);
|
|
if assigned(@_myvar2) then
|
|
halt(5);
|
|
if (_myvar<>$12345678) then
|
|
halt(6);
|
|
end.
|
|
{$else supported}
|
|
begin
|
|
{ no library support }
|
|
end.
|
|
{$endif supported}
|