\(\newcommand{\W}[1]{ \; #1 \; }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }\) \(\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }\) \(\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }\) \(\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }\)
create_dll_lib¶
View page sourceCreate a Dynamic Link Library¶
Syntax¶
include <cppad/utility/create_dll_lib.hpp>
create_dll_lib
( dll_file , csrc_files , options )Prototype¶
template <class StringVector>
std::string create_dll_lib(
const std::string& dll_file ,
const StringVector& csrc_files ,
const std::map<std::string, std::string>& options )
include¶
As with all the CppAD utilities, create_dll_lib.hpp
is included
by <cppad/cppad.hpp>
, and can also be included separately.
dll_file¶
This is the file where the dynamic link library file named dll_file .
This file name must have the proper extension for a dynamic link library
(.so
on unix and .dll
on windows).
StringVector¶
The type StringVector is a simple vector with elements
of type std::string
.
csrc_files¶
The vector csrc_files contains the names of the C source files that are compiled and linked to the library. These files do not have to have a specific extension.
options¶
The possible keys in this map are documented below. The default value for each key is used when the key does not appear in options .
compile¶
This is an abbreviated version of the compile command. It does not include the output file flag or output file name. If cmake detects that this is the MSVC compiler, the default value for this option is
cl /EHs /EHc /c /TC`
If cmake detects that this is the Clang or GNU compiler, the default value for this option is
cppad_c_compiler_cmd
-c -fPIC
Here and below cppad_c_compiler_cmd is the command used to run the C compiler (which is determined by cmake) .
link¶
This is an abbreviated version of the link command. It does not include the output file flag or output file name. In the MSVC case, the default for this option is
link /DLL
In the Clang or GNU case, the default for this option is
cppad_c_compiler_cmd
-shared
.
err_msg¶
If this string is empty, no error occurred. Otherwise the processing aborted and err_msg is the corresponding error message.
Example¶
The file dll_lib.cpp contains an example and test of
create_dll_lib
.