CppADCodeGen  2.4.3
A C++ Algorithmic Differentiation Package with Source Code Generation
linux_dynamic_model_library_processor.hpp
1 #ifndef CPPAD_CG_LINUX_C_LANG_COMPILE_DYNAMIC_HELPER_INCLUDED
2 #define CPPAD_CG_LINUX_C_LANG_COMPILE_DYNAMIC_HELPER_INCLUDED
3 /* --------------------------------------------------------------------------
4  * CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation:
5  * Copyright (C) 2012 Ciengis
6  *
7  * CppADCodeGen is distributed under multiple licenses:
8  *
9  * - Eclipse Public License Version 1.0 (EPL1), and
10  * - GNU General Public License Version 3 (GPL3).
11  *
12  * EPL1 terms and conditions can be found in the file "epl-v10.txt", while
13  * terms and conditions for the GPL3 can be found in the file "gpl3.txt".
14  * ----------------------------------------------------------------------------
15  * Author: Joao Leal
16  */
17 #if CPPAD_CG_SYSTEM_LINUX
18 
19 namespace CppAD {
20 namespace cg {
21 
22 template<class Base>
23 std::unique_ptr<DynamicLib<Base>> DynamicModelLibraryProcessor<Base>::loadDynamicLibrary() {
24  std::unique_ptr<DynamicLib<Base>> lib;
25  const auto it = _options.find("dlOpenMode");
26  if (it == _options.end()) {
27  lib.reset(new LinuxDynamicLib<Base>(_libraryName + system::SystemInfo<>::DYNAMIC_LIB_EXTENSION));
28  } else {
29  int dlOpenMode = std::stoi(it->second);
30  lib.reset(new LinuxDynamicLib<Base>(_libraryName + system::SystemInfo<>::DYNAMIC_LIB_EXTENSION, dlOpenMode));
31  }
32  return lib;
33 }
34 
35 } // END cg namespace
36 } // END CppAD namespace
37 
38 #endif
39 #endif