\hypertarget{group__Evil__Dlfcn}{}\section{Functions that manage dynamic-\/link libraries.}
\label{group__Evil__Dlfcn}\index{Functions that manage dynamic-\/link libraries.@{Functions that manage dynamic-\/link libraries.}}


x $\ast$ This header provides functions to load and unload dynamic-\/link libaries, to get the address of a symbol, and to get diagnostic information.  


\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{Elua_8h_a3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} void $\ast$ \hyperlink{group__Evil__Dlfcn_ga996da7599a89bb84423a0373171ddcee}{dlopen} (const char $\ast$path, int mode)
\begin{DoxyCompactList}\small\item\em Map a specified executable module (either a .dll or .exe file) into the address space of the user process. \end{DoxyCompactList}\item 
\hyperlink{Elua_8h_a3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} int \hyperlink{group__Evil__Dlfcn_ga1a63f96430b0d05189b31d7885b1e555}{dlclose} (void $\ast$handle)
\begin{DoxyCompactList}\small\item\em Close a dynamic-\/link library. \end{DoxyCompactList}\item 
\hyperlink{Elua_8h_a3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} void $\ast$ \hyperlink{group__Evil__Dlfcn_ga9bb047189e7ddc7a0abae154dd210743}{dlsym} (void $\ast$handle, const char $\ast$symbol)
\begin{DoxyCompactList}\small\item\em Get the address of a symbol. \end{DoxyCompactList}\item 
\hyperlink{Elua_8h_a3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} int \hyperlink{group__Evil__Dlfcn_ga935806a9720b4b3f1a9a64523c920a29}{dladdr} (const void $\ast$addr, \hyperlink{structDl__info}{Dl\+\_\+info} $\ast$info)
\begin{DoxyCompactList}\small\item\em Get the location of the current process (.exe) \end{DoxyCompactList}\item 
\hyperlink{Elua_8h_a3db3556eec8ef18cb8ddb43816974ac8}{E\+A\+P\+I} char $\ast$ \hyperlink{group__Evil__Dlfcn_gaa4b07f412ae40aaf5f5f5d7400c74c29}{dlerror} (void)
\begin{DoxyCompactList}\small\item\em Get diagnostic information. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
x $\ast$ This header provides functions to load and unload dynamic-\/link libaries, to get the address of a symbol, and to get diagnostic information. 



\subsection{Function Documentation}
\hypertarget{group__Evil__Dlfcn_ga996da7599a89bb84423a0373171ddcee}{}\index{Functions that manage dynamic-\/link libraries.@{Functions that manage dynamic-\/link libraries.}!dlopen@{dlopen}}
\index{dlopen@{dlopen}!Functions that manage dynamic-\/link libraries.@{Functions that manage dynamic-\/link libraries.}}
\subsubsection[{dlopen}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} void$\ast$ dlopen (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{path, }
\item[{int}]{mode}
\end{DoxyParamCaption}
)}\label{group__Evil__Dlfcn_ga996da7599a89bb84423a0373171ddcee}


Map a specified executable module (either a .dll or .exe file) into the address space of the user process. 


\begin{DoxyParams}{Parameters}
{\em path} & Name of the module. \\
\hline
{\em mode} & Unused. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A pointer that represent the module, or {\ttfamily N\+U\+L\+L} on failure.
\end{DoxyReturn}
Map a specified executable module (either a .dll or .exe file) into the address space of the user process. If {\ttfamily path} is {\ttfamily N\+U\+L\+L}, then the module corresponding to the current process is returned. Otherwise the module specified by {\ttfamily path} is loaded if it exists. If not, {\ttfamily N\+U\+L\+L} is returned. The directory separators can be forward slash, or backward ones. Mapping a module can map other modules. {\ttfamily mode} is unused.

If an error occurred, an error string can be retrived with \hyperlink{group__Evil__Dlfcn_gaa4b07f412ae40aaf5f5f5d7400c74c29}{dlerror()}.

According to the O\+S, the search order of the module can change, according to the value of Safe\+Dll\+Search\+Mode.


\begin{DoxyItemize}
\item For Windows Vista, Windows Server 2003, and Windows X\+P S\+P2\+: Safe\+D\+L\+L\+Search\+Mode is enabled by default.
\item For Windows X\+P and Windows 2000 S\+P4\+: Safe\+D\+L\+L\+Search\+Mode is disabled by default.
\end{DoxyItemize}

If Safe\+Dll\+Search\+Mode is enabled
\begin{DoxyItemize}
\item The directory from which the application loaded.
\item The system directory. Use the Get\+System\+Directory() function to get the path of this directory.
\item The 16-\/bit system directory. There is no function that obtains the path of this directory, but it is searched.
\item The Windows directory. Use the Get\+Windows\+Directory() function to get the path of this directory.
\item The current directory.
\item The directories that are listed in the P\+A\+T\+H environment variable. Note that this does not include the per-\/application path specified by the App Paths registry key.
\end{DoxyItemize}

If Safe\+Dll\+Search\+Mode is disabled
\begin{DoxyItemize}
\item The directory from which the application loaded.
\item The current directory.
\item The system directory. Use the Get\+System\+Directory() function to get the path of this directory.
\item The 16-\/bit system directory. There is no function that obtains the path of this directory, but it is searched.
\item The Windows directory. Use the Get\+Windows\+Directory() function to get the path of this directory.
\item The directories that are listed in the P\+A\+T\+H environment variable. Note that this does not include the per-\/application path specified by the App Paths registry key.
\end{DoxyItemize}

Conformity\+: None.

Supported O\+S\+: Windows Vista, Windows X\+P or Windows 2000 Professional. 

References evil\+\_\+char\+\_\+to\+\_\+wchar().



Referenced by ecore\+\_\+x\+\_\+init(), and eina\+\_\+module\+\_\+load().

\hypertarget{group__Evil__Dlfcn_ga1a63f96430b0d05189b31d7885b1e555}{}\index{Functions that manage dynamic-\/link libraries.@{Functions that manage dynamic-\/link libraries.}!dlclose@{dlclose}}
\index{dlclose@{dlclose}!Functions that manage dynamic-\/link libraries.@{Functions that manage dynamic-\/link libraries.}}
\subsubsection[{dlclose}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} int dlclose (
\begin{DoxyParamCaption}
\item[{void $\ast$}]{handle}
\end{DoxyParamCaption}
)}\label{group__Evil__Dlfcn_ga1a63f96430b0d05189b31d7885b1e555}


Close a dynamic-\/link library. 


\begin{DoxyParams}{Parameters}
{\em handle} & Handle that references a dynamic-\/link library. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
O on sucess, -\/1 otherwise.
\end{DoxyReturn}
Release a reference to the dynamic-\/link library referenced by {\ttfamily handle}. If the reference count drops to 0, the handle is removed from the address space and is rendered invalid. {\ttfamily handle} is the value returned by a previous call to \hyperlink{group__Evil__Dlfcn_ga996da7599a89bb84423a0373171ddcee}{dlopen()}.

If no error occurred, the returned value is 0, otherwise the returned value is -\/1 and an error string can be retrived with \hyperlink{group__Evil__Dlfcn_gaa4b07f412ae40aaf5f5f5d7400c74c29}{dlerror()}.

Conformity\+: None.

Supported O\+S\+: Windows Vista, Windows X\+P or Windows 2000 Professional. 

Referenced by eina\+\_\+module\+\_\+load(), and eina\+\_\+module\+\_\+unload().

\hypertarget{group__Evil__Dlfcn_ga9bb047189e7ddc7a0abae154dd210743}{}\index{Functions that manage dynamic-\/link libraries.@{Functions that manage dynamic-\/link libraries.}!dlsym@{dlsym}}
\index{dlsym@{dlsym}!Functions that manage dynamic-\/link libraries.@{Functions that manage dynamic-\/link libraries.}}
\subsubsection[{dlsym}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} void$\ast$ dlsym (
\begin{DoxyParamCaption}
\item[{void $\ast$}]{handle, }
\item[{const char $\ast$}]{symbol}
\end{DoxyParamCaption}
)}\label{group__Evil__Dlfcn_ga9bb047189e7ddc7a0abae154dd210743}


Get the address of a symbol. 


\begin{DoxyParams}{Parameters}
{\em handle} & Handle that references a dynamic-\/link library. \\
\hline
{\em symbol} & {\ttfamily N\+U\+L\+L-\/terminated} string. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
O on sucess, N\+U\+L\+L otherwise.
\end{DoxyReturn}
Return the address of the code or data location specified by the string {\ttfamily symbol}. {\ttfamily handle} references a library that contains the function or variable {\ttfamily symbol}.

If no error occurred, the returned value is the code or data location, otherwise the returned value is N\+U\+L\+L and an error string can be retrived with \hyperlink{group__Evil__Dlfcn_gaa4b07f412ae40aaf5f5f5d7400c74c29}{dlerror()}.

Conformity\+: None.

Supported O\+S\+: Windows Vista, Windows X\+P or Windows 2000 Professional. 

References evil\+\_\+char\+\_\+to\+\_\+wchar(), and R\+T\+L\+D\+\_\+\+D\+E\+F\+A\+U\+L\+T.



Referenced by ecore\+\_\+x\+\_\+init(), eina\+\_\+module\+\_\+load(), eina\+\_\+module\+\_\+symbol\+\_\+get(), and eina\+\_\+module\+\_\+unload().

\hypertarget{group__Evil__Dlfcn_ga935806a9720b4b3f1a9a64523c920a29}{}\index{Functions that manage dynamic-\/link libraries.@{Functions that manage dynamic-\/link libraries.}!dladdr@{dladdr}}
\index{dladdr@{dladdr}!Functions that manage dynamic-\/link libraries.@{Functions that manage dynamic-\/link libraries.}}
\subsubsection[{dladdr}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} int dladdr (
\begin{DoxyParamCaption}
\item[{const void $\ast$}]{addr, }
\item[{{\bf Dl\+\_\+info} $\ast$}]{info}
\end{DoxyParamCaption}
)}\label{group__Evil__Dlfcn_ga935806a9720b4b3f1a9a64523c920a29}


Get the location of the current process (.exe) 


\begin{DoxyParams}{Parameters}
{\em addr} & Unused. \\
\hline
{\em info} & Pointer to the \hyperlink{structDl__info}{Dl\+\_\+info} to fill. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1 on success, 0 otherwise.
\end{DoxyReturn}
Fill the dli\+\_\+fname member of {\ttfamily info} with the absolute name of the current calling process (.exe file that is executed). All other members are set to {\ttfamily N\+U\+L\+L}.

Contrary to the unix function, the full name of the shared library is not returned, but insted the full name of the current calling process (.exe file).

Conformity\+: None.

Supported O\+S\+: Windows Vista, Windows X\+P or Windows 2000 Professional. 

Referenced by eina\+\_\+module\+\_\+symbol\+\_\+path\+\_\+get(), and eina\+\_\+prefix\+\_\+new().

\hypertarget{group__Evil__Dlfcn_gaa4b07f412ae40aaf5f5f5d7400c74c29}{}\index{Functions that manage dynamic-\/link libraries.@{Functions that manage dynamic-\/link libraries.}!dlerror@{dlerror}}
\index{dlerror@{dlerror}!Functions that manage dynamic-\/link libraries.@{Functions that manage dynamic-\/link libraries.}}
\subsubsection[{dlerror}]{\setlength{\rightskip}{0pt plus 5cm}{\bf E\+A\+P\+I} char$\ast$ dlerror (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{group__Evil__Dlfcn_gaa4b07f412ae40aaf5f5f5d7400c74c29}


Get diagnostic information. 

\begin{DoxyReturn}{Returns}
A {\ttfamily N\+U\+L\+L-\/terminated} string if an error occurred, {\ttfamily N\+U\+L\+L} otherwise.
\end{DoxyReturn}
Return a {\ttfamily N\+U\+L\+L-\/terminated} character string describing the last error that occurred on this thread during a call to \hyperlink{group__Evil__Dlfcn_ga996da7599a89bb84423a0373171ddcee}{dlopen()}, \hyperlink{group__Evil__Dlfcn_ga9bb047189e7ddc7a0abae154dd210743}{dlsym()}, or \hyperlink{group__Evil__Dlfcn_ga1a63f96430b0d05189b31d7885b1e555}{dlclose()}. If no such error has occurred, \hyperlink{group__Evil__Dlfcn_gaa4b07f412ae40aaf5f5f5d7400c74c29}{dlerror()} returns a null pointer. At each call to \hyperlink{group__Evil__Dlfcn_gaa4b07f412ae40aaf5f5f5d7400c74c29}{dlerror()}, the error indication is reset. Thus in the case of two calls to \hyperlink{group__Evil__Dlfcn_gaa4b07f412ae40aaf5f5f5d7400c74c29}{dlerror()}, where the second call follows the first immediately, the second call will always return a null pointer.

Conformity\+: None.

Supported O\+S\+: Windows Vista, Windows X\+P or Windows 2000 Professional. 

Referenced by eina\+\_\+module\+\_\+load().

