fork(1) download
  1. program ideone;
  2. {$mode objfpc}
  3. uses dynlibs;
  4.  
  5. type
  6. TStrLen = function(a:pchar):SizeInt; StdCall;
  7.  
  8. var
  9. LibC: TLibHandle = NilHandle;
  10. Func: TStrLen;
  11.  
  12. begin
  13. LibC := LoadLibrary('libc.so.6');
  14. if LibC = NilHandle then Exit;
  15. Func := TStrLen(GetProcedureAddress(LibC, 'strlen'));
  16. Writeln(Func('Test'));
  17. end.
Success #stdin #stdout 0s 6416KB
stdin
Standard input is empty
stdout
4