Coverage Report

Created: 2025-11-04 07:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ogre/OgreMain/include/OgreDynLib.h
Line
Count
Source
1
/*
2
-----------------------------------------------------------------------------
3
This source file is part of OGRE
4
    (Object-oriented Graphics Rendering Engine)
5
For the latest info, see http://www.ogre3d.org/
6
7
Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9
Permission is hereby granted, free of charge, to any person obtaining a copy
10
of this software and associated documentation files (the "Software"), to deal
11
in the Software without restriction, including without limitation the rights
12
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
copies of the Software, and to permit persons to whom the Software is
14
furnished to do so, subject to the following conditions:
15
16
The above copyright notice and this permission notice shall be included in
17
all copies or substantial portions of the Software.
18
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
THE SOFTWARE.
26
-----------------------------------------------------------------------------
27
*/
28
#ifndef _DynLib_H__
29
#define _DynLib_H__
30
31
#include "OgrePrerequisites.h"
32
#include "OgreHeaderPrefix.h"
33
34
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
35
struct HINSTANCE__;
36
#endif
37
38
namespace Ogre {
39
    /** \addtogroup Core
40
    *  @{
41
    */
42
    /** \addtogroup General
43
    *  @{
44
    */
45
46
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
47
    typedef struct HINSTANCE__* DYNLIB_HANDLE;
48
#else
49
    typedef void* DYNLIB_HANDLE;
50
#endif
51
52
    /** Resource holding data about a dynamic library.
53
54
        This class holds the data required to get symbols from
55
        libraries loaded at run-time (i.e. from DLL's for so's)
56
        @author
57
            Adrian Cearn„u (cearny@cearny.ro)
58
    */
59
    class _OgreExport DynLib : public DynLibAlloc
60
    {
61
    private:
62
        String mName;
63
        /// Gets the last loading error
64
        String dynlibError(void);
65
    public:
66
        /** Default constructor - used by DynLibManager.
67
            @warning
68
                Do not call directly
69
        */
70
        DynLib( const String& name );
71
72
        /** Default destructor.
73
        */
74
        ~DynLib();
75
76
        /** Load the library
77
        */
78
        void load();
79
        /** Unload the library
80
        */
81
        void unload();
82
        /// Get the name of the library
83
0
        const String& getName(void) const { return mName; }
84
85
        /**
86
            Returns the address of the given symbol from the loaded library.
87
            @param
88
                strName The name of the symbol to search for
89
            @return
90
                If the function succeeds, the returned value is a handle to
91
                the symbol.
92
            @par
93
                If the function fails, the returned value is <b>NULL</b>.
94
95
        */
96
        void* getSymbol( const String& strName ) const throw();
97
98
    private:
99
100
        /// Handle to the loaded library.
101
        DYNLIB_HANDLE mInst;
102
    };
103
    /** @} */
104
    /** @} */
105
106
}
107
108
#include "OgreHeaderSuffix.h"
109
110
#endif