LCOV - code coverage report
Current view: top level - muse/framework/global - dlib.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 7 0
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2022 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : 
      23              : #ifndef MUSE_GLOBAL_DLIB_H
      24              : #define MUSE_GLOBAL_DLIB_H
      25              : 
      26              : #if defined(Q_OS_WIN) && !defined(__MINGW64__)
      27              : #include <windows.h>
      28              : #else
      29              : #include <dlfcn.h>
      30              : #endif
      31              : 
      32              : #include "io/path.h"
      33              : 
      34              : #include "log.h"
      35              : 
      36              : namespace muse {
      37            0 : inline void* loadLib(const io::path_t& path)
      38              : {
      39              : #if defined(Q_OS_WIN) && !defined(__MINGW64__)
      40              :     return LoadLibrary(io::toNativeSeparators(path).toStdWString().data());
      41              : #else
      42            0 :     return dlopen(io::toNativeSeparators(path).toStdString().data(), RTLD_LAZY);
      43              : #endif
      44              : }
      45              : 
      46            0 : inline void* getLibFunc(void* libHandle, const char* funcName)
      47              : {
      48              : #if defined(Q_OS_WIN) && !defined(__MINGW64__)
      49              :     return GetProcAddress((HINSTANCE)libHandle, funcName);
      50              : #else
      51            0 :     return dlsym(libHandle, funcName);
      52              : #endif
      53              : }
      54              : 
      55            0 : inline void closeLib(void* libHandle)
      56              : {
      57              : #if defined(Q_OS_WIN) && !defined(__MINGW64__)
      58              :     UNUSED(libHandle);
      59              :     return;
      60              : #else
      61            0 :     dlclose(libHandle);
      62              : #endif
      63            0 : }
      64              : }
      65              : 
      66              : #endif // MUSE_GLOBAL_DLIB_H
        

Generated by: LCOV version 2.0-1