fpc/docs/dxeload.tex
2000-07-03 14:43:53 +00:00

61 lines
2.2 KiB
TeX

%
% $Id$
% This file is part of the FPC documentation.
% Copyright (C) 1997, by Michael Van Canneyt
%
% The FPC documentation is free text; you can redistribute it and/or
% modify it under the terms of the GNU Library General Public License as
% published by the Free Software Foundation; either version 2 of the
% License, or (at your option) any later version.
%
% The FPC Documentation is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
% Library General Public License for more details.
%
% You should have received a copy of the GNU Library General Public
% License along with the FPC documentation; see the file COPYING.LIB. If not,
% write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
% Boston, MA 02111-1307, USA.
%
\chapter{The DXELOAD unit}
\section{Introduction}
The \file{dxeload} unit was implemented by Pierre M\"uller for \dos,
it allows to load a DXE file (an object file with 1 entry point)
into memory and return a pointer to the entry point.
It exists only for \dos.
\section{Constants, types and variables}
\subsection{Constants}
The following constant is the magic number, found in the header of a DXE
file.
\begin{verbatim}
DXE_MAGIC = $31455844;
\end{verbatim}
\subsection{Types}
The following record describes the header of a DXE file. It is used to
determine the magic number of the DXE file and number of relocations that
must be done when the object file i sloaded in memory.
\begin{verbatim}
dxe_header = record
magic,
symbol_offset,
element_size,
nrelocs : longint;
end;
\end{verbatim}
\section{Functions and Procedures}
\begin{functionl}{dxe\_load}{dxeload}
\Declaration
function dxe\_load(filename : string) : pointer;
\Description
\var{dxe\_load} loads the contents of the file \var{filename} into memory.
It performs the necessary relocations in the object code, and returns then
a pointer to the entry point of the code.
\Errors
If an error occurs during the load or relocations, \var{Nil} is returned.
\end{functionl}
For an example, see the \file{emu387} unit in the RTL.