dynlibs.pp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. Type
  31. HModule = TLibHandle;
  32. Implementation
  33. { ---------------------------------------------------------------------
  34. OS - Independent declarations.
  35. ---------------------------------------------------------------------}
  36. {$i dynlibs.inc}
  37. Function FreeLibrary(Lib : TLibHandle) : Boolean;
  38. begin
  39. Result:=UnloadLibrary(lib);
  40. end;
  41. Function GetProcAddress(Lib : TlibHandle; ProcName : AnsiString) : Pointer;
  42. begin
  43. Result:=GetProcedureAddress(Lib,Procname);
  44. end;
  45. end.
  46. {
  47. $Log$
  48. Revision 1.7 2005-05-04 09:04:58 michael
  49. + Added HModule compatibility
  50. Revision 1.6 2005/02/14 17:13:22 peter
  51. * truncate log
  52. }