2
0

dxeload.tex 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. %
  2. % $Id$
  3. % This file is part of the FPC documentation.
  4. % Copyright (C) 1997, by Michael Van Canneyt
  5. %
  6. % The FPC documentation is free text; you can redistribute it and/or
  7. % modify it under the terms of the GNU Library General Public License as
  8. % published by the Free Software Foundation; either version 2 of the
  9. % License, or (at your option) any later version.
  10. %
  11. % The FPC Documentation is distributed in the hope that it will be useful,
  12. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. % Library General Public License for more details.
  15. %
  16. % You should have received a copy of the GNU Library General Public
  17. % License along with the FPC documentation; see the file COPYING.LIB. If not,
  18. % write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. % Boston, MA 02111-1307, USA.
  20. %
  21. \chapter{The DXELOAD unit}
  22. \section{Introduction}
  23. The \file{dxeload} unit was implemented by Pierre M\"uller for \dos,
  24. it allows to load a DXE file (an object file with 1 entry point)
  25. into memory and return a pointer to the entry point.
  26. It exists only for \dos.
  27. \section{Constants, types and variables}
  28. \subsection{Constants}
  29. The following constant is the magic number, found in the header of a DXE
  30. file.
  31. \begin{verbatim}
  32. DXE_MAGIC = $31455844;
  33. \end{verbatim}
  34. \subsection{Types}
  35. The following record describes the header of a DXE file. It is used to
  36. determine the magic number of the DXE file and number of relocations that
  37. must be done when the object file i sloaded in memory.
  38. \begin{verbatim}
  39. dxe_header = record
  40. magic,
  41. symbol_offset,
  42. element_size,
  43. nrelocs : longint;
  44. end;
  45. \end{verbatim}
  46. \section{Functions and Procedures}
  47. \begin{functionl}{dxe\_load}{dxeload}
  48. \Declaration
  49. function dxe\_load(filename : string) : pointer;
  50. \Description
  51. \var{dxe\_load} loads the contents of the file \var{filename} into memory.
  52. It performs the necessary relocations in the object code, and returns then
  53. a pointer to the entry point of the code.
  54. \Errors
  55. If an error occurs during the load or relocations, \var{Nil} is returned.
  56. \end{functionl}
  57. For an example, see the \file{emu387} unit in the RTL.