|
CASM
1.1.0
A Clusters Approach to Statistical Mechanics
|
#include <RuntimeLibrary.hh>
Write, compile, load and use code at runtime.
Definition at line 41 of file RuntimeLibrary.hh.
Public Member Functions | |
| RuntimeLibrary (std::string _filename_base, std::string _compile_options, std::string _so_options) | |
| Construct a RuntimeLibrary object, with the options to be used for compile the '.o' file and the '.so' file. More... | |
| ~RuntimeLibrary () | |
| template<typename Signature > | |
| std::function< Signature > | get_function (std::string function_name) const |
| Obtain a function from the current library. More... | |
| void | rm () |
| Remove the current library and source code. More... | |
Static Public Member Functions | |
| static std::pair< std::string, std::string > | default_cxxflags () |
| Default c++ compiler options. More... | |
| static std::pair< std::string, std::string > | default_soflags () |
| Default c++ compiler options. More... | |
| static std::pair< std::string, std::string > | default_cxx () |
| Return default compiler. More... | |
| static std::pair< fs::path, std::string > | default_casm_includedir () |
| Return default includedir for CASM. More... | |
| static std::pair< fs::path, std::string > | default_casm_libdir () |
| Return default libdir for CASM. More... | |
| static std::pair< fs::path, std::string > | default_boost_includedir () |
| Return default includedir for boost. More... | |
| static std::pair< fs::path, std::string > | default_boost_libdir () |
| Return default libdir for boost. More... | |
Private Member Functions | |
| void | _compile () |
| Compile a shared library. More... | |
| void | _load () |
| Load a library with a given name. More... | |
| void | _close () |
| Close the current library. More... | |
Private Attributes | |
| std::string | m_filename_base |
| std::string | m_compile_options |
| std::string | m_so_options |
| void * | m_handle |
| CASM::RuntimeLibrary::RuntimeLibrary | ( | std::string | _filename_base, |
| std::string | _compile_options, | ||
| std::string | _so_options | ||
| ) |
Construct a RuntimeLibrary object, with the options to be used for compile the '.o' file and the '.so' file.
Definition at line 47 of file RuntimeLibrary.cc.
| CASM::RuntimeLibrary::~RuntimeLibrary | ( | ) |
Definition at line 79 of file RuntimeLibrary.cc.
|
private |
Close the current library.
This is also done on destruction.
Definition at line 138 of file RuntimeLibrary.cc.
|
private |
Compile a shared library.
| _filename_base | Base name for the source code file. For example, "/path/to/hello" looks for "/path/to/hello.cc", and compile "/path/to/hello.o" and "/path/to/hello.so". |
To enable runtime symbol lookup use C-style functions, i.e use extern "C" for functions you want to use via get_function. This means no member functions or overloaded functions.
Definition at line 100 of file RuntimeLibrary.cc.
|
private |
Load a library with a given name.
| _filename_base | For "hello", this loads "hello.so" |
Definition at line 126 of file RuntimeLibrary.cc.
|
static |
Return default includedir for boost.
Return include path option for boost.
Definition at line 347 of file RuntimeLibrary.cc.
|
static |
Return default libdir for boost.
Return lib path option for boost.
Definition at line 376 of file RuntimeLibrary.cc.
|
static |
Return default includedir for CASM.
Return include path option for CASM.
Definition at line 289 of file RuntimeLibrary.cc.
|
static |
Return default libdir for CASM.
Return lib path option for CASM.
Definition at line 318 of file RuntimeLibrary.cc.
|
static |
Return default compiler.
Return default compiler and specifying variable.
Definition at line 267 of file RuntimeLibrary.cc.
|
static |
Default c++ compiler options.
Definition at line 274 of file RuntimeLibrary.cc.
|
static |
Default c++ compiler options.
Default c++ shared library options.
Definition at line 281 of file RuntimeLibrary.cc.
|
inline |
Obtain a function from the current library.
Must be a C-style function to enable symbol lookup, i.e your source code should use extern "C". This means no member functions or overloaded functions.
Definition at line 58 of file RuntimeLibrary.hh.
| void CASM::RuntimeLibrary::rm | ( | ) |
Remove the current library and source code.
Definition at line 147 of file RuntimeLibrary.cc.
|
private |
Definition at line 106 of file RuntimeLibrary.hh.
|
private |
Definition at line 105 of file RuntimeLibrary.hh.
|
private |
Definition at line 109 of file RuntimeLibrary.hh.
|
private |
Definition at line 107 of file RuntimeLibrary.hh.