dynlibs.pp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. Implements OS-independent loading of dynamic libraries.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$MODE OBJFPC}
  13. unit dynlibs;
  14. interface
  15. { ---------------------------------------------------------------------
  16. Read OS-dependent interface declarations.
  17. ---------------------------------------------------------------------}
  18. {$define readinterface}
  19. {$i dynlibs.inc}
  20. {$undef readinterface}
  21. { ---------------------------------------------------------------------
  22. OS - Independent declarations.
  23. ---------------------------------------------------------------------}
  24. Function LoadLibrary(Name : AnsiString) : TLibHandle;
  25. Function GetProcedureAddress(Lib : TlibHandle; ProcName : AnsiString) : Pointer;
  26. Function UnloadLibrary(Lib : TLibHandle) : Boolean;
  27. // Kylix/Delphi compability
  28. Function FreeLibrary(Lib : TLibHandle) : Boolean;
  29. Function GetProcAddress(Lib : TlibHandle; ProcName : AnsiString) : Pointer;
  30. Implementation
  31. { ---------------------------------------------------------------------
  32. OS - Independent declarations.
  33. ---------------------------------------------------------------------}
  34. {$i dynlibs.inc}
  35. Function FreeLibrary(Lib : TLibHandle) : Boolean;
  36. begin
  37. Result:=UnloadLibrary(lib);
  38. end;
  39. Function GetProcAddress(Lib : TlibHandle; ProcName : AnsiString) : Pointer;
  40. begin
  41. Result:=GetProcedureAddress(Lib,Procname);
  42. end;
  43. end.
  44. {
  45. $Log$
  46. Revision 1.5 2004-06-13 09:34:52 michael
  47. + Fix for bug 3164 by Michalis Kamburelis
  48. Revision 1.4 2004/06/12 13:30:33 michael
  49. Fixed bug 3156, as suggested by Michalis Kamburelis
  50. Revision 1.3 2004/05/04 17:14:52 marco
  51. * some delphi compat aliases added.
  52. Revision 1.2 2002/09/07 15:07:45 peter
  53. * old logs removed and tabs fixed
  54. }