\subsection{externaldata}
\label{labexternaldata}
\noindent Name: \textbf{externaldata}\\
\phantom{aaa}binds an external data symbol to a \sollya identifier\\[0.2cm]
\noindent Library name:\\
\verb|       sollya_obj_t sollya_lib_externaldata(char *, void *, void (*)(void *));|\\[0.2cm]
\noindent Usage: 
\begin{center}
\textbf{externaldata}(\emph{identifier}, \emph{filename}) : (\textsf{identifier type}, \textsf{string}) $\rightarrow$ \textsf{void}\\
\end{center}
Parameters: 
\begin{itemize}
\item \emph{identifier} represents the identifier the external symbol is to be bound to
\item \emph{filename} of type \textsf{string} represents the name of the object file where the external symbol can be found
\end{itemize}
\noindent Description: \begin{itemize}

\item \textbf{externaldata} allows for binding the \sollya identifier \emph{identifier} to an
   external symbol, looked up in a dynamically linked library. After this
   binding, \sollya can retrieve the bound object in its own symbol
   table, can copy it, can assign it to other variables, pass is as
   arguments to procedures and externalprocedures, compare it
   etc. However, \sollya stays agnostic of the symbol's meaning and
   type. Due to this reason, the use of \textbf{externaldata} makes no sense but in
   conjuction with the use of \textbf{externalproc}, where an external procedure
   is bound to \sollya. This external procedure may know the type and
   meaning of the object bound with \textbf{externaldata} and display it, handle it,
   execute it etc. The same functionality may also be used for tools that
   use \sollya thru its library interface to bind their own objects to
   \sollya, pass them thru \sollya code and retrieve them eventually.
\end{itemize}
\noindent Example 1: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> bashexecute("gcc -fPIC -Wall -I.. -I. -c externaldataexample.c");
> bashexecute("gcc -fPIC -shared -o externaldataexample externaldataexample.o");

> externaldata(magic, "./externaldataexample");
> magic;
magic
> print(magic);
magic
> magic == magic;
true
> magic == 17;
false
> zauberei = magic;
> zauberei;
magic
> zauberei == magic;
true
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 2: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> bashexecute("gcc -fPIC -Wall -I.. -I. -c externaldataexample.c");
> bashexecute("gcc -fPIC -shared -o externaldataexample externaldataexample.o");

> externaldata(magic, "./externaldataexample");
> externalproc(printMagic, "./externaldataexample", object -> void);
> zauberei = magic;
> printMagic;
printMagic
> printMagic(magic);
The magic is 17
> printMagic(magic);
The magic is 18
> printMagic(zauberei);
The magic is 19
> procedure magicAsParameter(m) {
        m;
        printMagic(m);
        m;
  };
> magicAsParameter(magic);
magic
The magic is 20
magic
> magicAsParameter(zauberei);
magic
The magic is 21
magic
\end{Verbatim}
\end{minipage}\end{center}
See also: \textbf{library} (\ref{lablibrary}), \textbf{libraryconstant} (\ref{lablibraryconstant}), \textbf{externalproc} (\ref{labexternalproc}), \textbf{externalplot} (\ref{labexternalplot}), \textbf{bashexecute} (\ref{labbashexecute}), \textbf{void} (\ref{labvoid}), \textbf{constant} (\ref{labconstant}), \textbf{function} (\ref{labfunction}), \textbf{range} (\ref{labrange}), \textbf{integer} (\ref{labinteger}), \textbf{string} (\ref{labstring}), \textbf{boolean} (\ref{labboolean}), \textbf{list of} (\ref{lablistof}), \textbf{object} (\ref{labobject})
