* as shared libraries without glibc on linux currently don't work, link those tests

on current fpc versions and linux always against glibc, so the shared library handling is tested
This commit is contained in:
florian 2024-09-19 22:57:45 +02:00
parent a46c6229c5
commit 8b48127b2c
8 changed files with 55 additions and 41 deletions

View File

@ -16,6 +16,11 @@
{$ifdef supported}
{$if (FPC_FULLVERSION<=30301) and defined(linux)}
uses
initc;
{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
const
{$ifdef windows}
libname='tlibrary1.dll';

View File

@ -1,24 +1,12 @@
{ %NORUN }
{ %SKIPTARGET=macos, $nosharedlib, win64 }
{ %delfiles=tlibrary3 }
{ %skiptarget=$nosharedlib }
{ %NEEDLIBRARY }
{ %delfiles=tlibrary1 }
{$ifdef darwin}
{$PIC+}
{$endif darwin}
{$ifdef CPUX86_64}
{$ifndef WINDOWS}
{$PIC+}
{$endif WINDOWS}
{$endif CPUX86_64}
{ The .so of the library needs to be in the current dir when
testing the loading at runtime }
{ Test program to test linking to fpc library }
{$ifdef mswindows}
{$define supported}
{$define supportidx}
{$endif win32}
{$endif mswindows}
{$ifdef Unix}
{$define supported}
{$endif Unix}
@ -28,32 +16,25 @@
{$ifdef supported}
library bug;
uses
initc;
const
publicname='TestName';
publicindex = 1234;
procedure Test;export;
begin
// writeln('Hoi');
end;
exports
Test name publicname;
{$ifdef supportidx}
exports
Test index publicindex;
{$ifdef windows}
libname='tlibrary1.dll';
{$else}
libname='tlibrary1';
{$linklib tlibrary1}
{$endif}
procedure test;external libname name 'TestName';
begin
if islibrary then
halt(3);
if moduleislib then
halt(4);
test;
end.
{$else supported}
{$else not supported}
begin
Writeln('No library for that target');
Writeln('Dummy test because target does not support libraries');
end.
{$endif supported}
{$endif not supported}

View File

@ -11,6 +11,11 @@
{$ifdef supported}
{$if (FPC_FULLVERSION<=30301) and defined(linux)}
uses
initc;
{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
const
{$ifdef windows}
libname='tweaklib1.dll';

View File

@ -6,7 +6,11 @@
program MainApp;
uses
sysutils;
sysutils
{$if (FPC_FULLVERSION<=30301) and defined(linux)}
,initc
{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
;
const
{$ifdef windows}

View File

@ -6,6 +6,11 @@ program ptest;
{$ifdef fpc}{$mode objfpc}{$H+}{$endif fpc}
{$if (FPC_FULLVERSION<=30301) and defined(linux)}
uses
initc;
{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
const
{$if defined(windows) or defined(mswindows)}
libname='tw16949a.dll';

View File

@ -2,6 +2,11 @@
{ %target=linux,haiku }
{$mode objfpc}
{$if (FPC_FULLVERSION<=30301) and defined(linux)}
uses
initc;
{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
{$linklib tw3964a}
function testfunc : longint;

View File

@ -5,7 +5,11 @@
program MainApp;
uses
sysutils;
sysutils
{$if (FPC_FULLVERSION<=30301) and defined(linux)}
,initc
{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
;
const
{$ifdef windows}

View File

@ -6,6 +6,11 @@ program ptest;
{$ifdef fpc}{$mode objfpc}{$H+}{$endif fpc}
{$if (FPC_FULLVERSION<=30301) and defined(linux)}
uses
initc;
{$endif (FPC_FULLVERSION<=30301) and defined(linux)}
const
{$if defined(windows) or defined(mswindows)}
libname='tw9089b.dll';