Skip to content

Commit

Permalink
Closes #2192
Browse files Browse the repository at this point in the history
Improve example for annotations for external libraries; correct typo and improve in general.
  • Loading branch information
HansOlsson committed May 10, 2019
1 parent 93631c6 commit 2f90830
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions chapters/functions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2141,13 +2141,13 @@ \subsection{Annotations for External Libraries and Include Files}\doublelabel{an
Modelica compiler. The included code should be valid C89 code.
\item
The
\lstinline!annotation(IncludeDirectory="modelica://LibraryName/Resources/Include")!,
\lstinline!annotation(IncludeDirectory="modelica://ModelicaLibraryName/Resources/Include")!,
used to specify a location for header files. The preceding one is the
default and need not be specified; but another location could be
specified by using an URI name for the include directory, see \autoref{external-resources}.
\item
The
\lstinline!annotation(LibraryDirectory="modelica://LibraryName/Resources/Library")!,
\lstinline!annotation(LibraryDirectory="modelica://ModelicaLibraryName/Resources/Library")!,
used to specify a location for library files. The preceding one is the
default and need not be specified; but another location could be
specified by using an URI name for the library directory, see \autoref{external-resources}.
Expand Down Expand Up @@ -2183,7 +2183,7 @@ \subsection{Annotations for External Libraries and Include Files}\doublelabel{an
text "../win32/vs2005" (or "vs2005") suggesting that it is compatible
with vs2005.}{]}
The \lstinline!LibraryName! used for \lstinline!IncludeDirectory! and \lstinline!LibraryDirectory!
The \lstinline!ModelicaLibraryName! used for \lstinline!IncludeDirectory! and \lstinline!LibraryDirectory!
indicates the top-level class where the annotation is found in the
Modelica source code.
Expand All @@ -2198,25 +2198,30 @@ \subsection{Annotations for External Libraries and Include Files}\doublelabel{an
der(x)=-ExternalFunc1(x);
der(y)=-ExternalFunc2(y);
end Example;
model OtherExample
Real x(start=1.0);
equation
der(x)=-ExternalFunc3(x);
end OtherExample;
function ExternalFunc1
input Real x;
output Real y;
external "C"
y=ExternalFunc1_ext(x) annotation(Library="ExternalLib11",Include="#include \"ExternalFunc1.h\"");
y=ExternalFunc1_ext(x) annotation(Library="ExternalLib1",Include="#include \"ExternalFunc1.h\"");
end ExternalFunc1;
function ExternalFunc2
input Real x;
output Real y;
external "C" annotation(Include="\#include \"ExternalFunc3.c\"");
external "C" annotation(Library="ExternalLib2", Include="#include \"ExternalFunc2.h\"");
end ExternalFunc2;
function ExternalFunc3
input Real x;
output Real y;
external
y=ExternalFunc3_ext(x) annotation(Library="ExternalLib11", Include="#include \"ExternalFunc1.h\"");
external "C" annotation(Include="#include \"ExternalFunc3.c\"");
end ExternalFunc3;
end ExternalFunctions;
Expand Down Expand Up @@ -2249,7 +2254,8 @@ \subsection{Annotations for External Libraries and Include Files}\doublelabel{an
package.mo
\end{lstlisting}
\emph{Note that calling MyExternalFunctions.ExternalFunc1 will use
header and library files from ExternalFunctions.}
header and library files from ExternalFunction, the ExternalFunctions.Example will not use ExternalFunc3.c,
and one library file may contain multiple functions.}
\emph{Header file for the function in the dynamic link / shared library
ExternalLib2 so that the desired functions are defined to be exported
Expand Down

0 comments on commit 2f90830

Please sign in to comment.