https://mooseframework.inl.gov
Loading...
Searching...
No Matches
solid_mechanics
src
utils
DynamicLibraryLoader.C
Go to the documentation of this file.
1
//* This file is part of the MOOSE framework
2
//* https://mooseframework.inl.gov
3
//*
4
//* All rights reserved, see COPYRIGHT for full restrictions
5
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6
//*
7
//* Licensed under LGPL 2.1, please see LICENSE for details
8
//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10
#include "
DynamicLibraryLoader.h
"
11
#include "
MooseUtils.h
"
12
13
DynamicLibraryLoader::DynamicLibraryLoader
(
const
std::string & library_file)
14
: _library_file(library_file)
15
{
16
MooseUtils::checkFileReadable
(
_library_file
,
false
,
/*throw_on_unreadable=*/
true
);
17
#ifdef LIBMESH_HAVE_DLOPEN
18
_handle
= dlopen(
_library_file
.c_str(), RTLD_LAZY);
19
if
(!
_handle
)
20
mooseError
(
"Failed to load library '"
,
_library_file
,
"' in DynamicLibraryLoader: "
, dlerror());
21
22
dlerror();
23
#else
24
// support for the POSIX function 'dlopen' to dynamically load libraries is missing
25
mooseError
(
"Dynamic library loading is not supported on this operating system."
);
26
#endif
27
}
28
29
DynamicLibraryLoader::~DynamicLibraryLoader
()
30
{
31
#ifdef LIBMESH_HAVE_DLOPEN
32
dlclose(
_handle
);
33
#endif
34
}
DynamicLibraryLoader.h
mooseError
void mooseError(Args &&... args)
MooseUtils.h
DynamicLibraryLoader::DynamicLibraryLoader
DynamicLibraryLoader(const std::string &library_file)
Definition
DynamicLibraryLoader.C:13
DynamicLibraryLoader::_handle
void * _handle
Library handle returned by dlopen.
Definition
DynamicLibraryLoader.h:39
DynamicLibraryLoader::~DynamicLibraryLoader
~DynamicLibraryLoader()
Definition
DynamicLibraryLoader.C:29
DynamicLibraryLoader::_library_file
const std::string _library_file
Library file name.
Definition
DynamicLibraryLoader.h:42
MooseUtils::checkFileReadable
bool checkFileReadable(const std::string &filename, bool check_line_endings, bool throw_on_unreadable, bool check_for_git_lfs_pointer)
Generated on Fri Aug 21 2026 13:41:46 for https://mooseframework.inl.gov by
1.9.8