mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-19 21:42:33 +02:00
24 lines
421 B
ObjectPascal
24 lines
421 B
ObjectPascal
program testsubs;
|
|
|
|
uses dynlibs;
|
|
|
|
Type
|
|
TSubStrFunc =
|
|
function(const CString:PChar;FromPos,ToPos: longint):PChar;cdecl;
|
|
|
|
var
|
|
s: PChar;
|
|
FromPos, ToPos: Integer;
|
|
lib : TLibHandle;
|
|
SubStr : TSubStrFunc;
|
|
|
|
begin
|
|
s := 'Test';
|
|
FromPos := 2;
|
|
ToPos := 3;
|
|
lib:=LoadLibrary('libsubs.so');
|
|
Pointer(Substr):=GetProcedureAddress(lib,'SubStr');
|
|
WriteLn(SubStr(s, FromPos, ToPos));
|
|
UnLoadLibrary(lib);
|
|
end.
|