LCOV - code coverage report
Current view: top level - src/utils - DynamicLibraryLoader.C (source / functions) Hit Total Coverage
Test: idaholab/moose solid_mechanics: f45d79 Lines: 10 11 90.9 %
Date: 2025-07-25 05:00:39 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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        1170 : DynamicLibraryLoader::DynamicLibraryLoader(const std::string & library_file)
      14        1170 :   : _library_file(library_file)
      15             : {
      16        1170 :   MooseUtils::checkFileReadable(_library_file, false, /*throw_on_unreadable=*/true);
      17             : #ifdef LIBMESH_HAVE_DLOPEN
      18        1170 :   _handle = dlopen(_library_file.c_str(), RTLD_LAZY);
      19        1170 :   if (!_handle)
      20           0 :     mooseError("Failed to load library '", _library_file, "' in DynamicLibraryLoader: ", dlerror());
      21             : 
      22        1170 :   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        1170 : }
      28             : 
      29        1156 : DynamicLibraryLoader::~DynamicLibraryLoader()
      30             : {
      31             : #ifdef LIBMESH_HAVE_DLOPEN
      32        1156 :   dlclose(_handle);
      33             : #endif
      34        1156 : }

Generated by: LCOV version 1.14