Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre_src_v1-9-0/OgreMain/include/OgreDynLib.h @ 151

Last change on this file since 151 was 148, checked in by patricwi, 6 years ago

Added new dependencies for ogre1.9 and cegui0.8

File size: 4.4 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2013 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE 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
35#    define DYNLIB_HANDLE hInstance
36#    define DYNLIB_LOAD( a ) LoadLibraryEx( a, NULL, 0 ) // we can not use LOAD_WITH_ALTERED_SEARCH_PATH with relative paths
37#    define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
38#    define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
39
40struct HINSTANCE__;
41typedef struct HINSTANCE__* hInstance;
42
43#elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
44#    define DYNLIB_HANDLE hInstance
45#    define DYNLIB_LOAD( a ) LoadPackagedLibrary( UTFString(a).asWStr_c_str(), 0 )
46#    define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
47#    define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
48
49struct HINSTANCE__;
50typedef struct HINSTANCE__* hInstance;
51
52#elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_ANDROID || OGRE_PLATFORM == OGRE_PLATFORM_NACL || OGRE_PLATFORM == OGRE_PLATFORM_FLASHCC
53#    define DYNLIB_HANDLE void*
54#    define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY | RTLD_GLOBAL)
55#    define DYNLIB_GETSYM( a, b ) dlsym( a, b )
56#    define DYNLIB_UNLOAD( a ) dlclose( a )
57
58#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
59#    define DYNLIB_HANDLE void*
60#    define DYNLIB_LOAD( a ) mac_loadDylib( a )
61#    define FRAMEWORK_LOAD( a ) mac_loadFramework( a )
62#    define DYNLIB_GETSYM( a, b ) dlsym( a, b )
63#    define DYNLIB_UNLOAD( a ) dlclose( a )
64
65#endif
66
67namespace Ogre {
68        /** \addtogroup Core
69        *  @{
70        */
71        /** \addtogroup General
72        *  @{
73        */
74
75    /** Resource holding data about a dynamic library.
76        @remarks
77            This class holds the data required to get symbols from
78            libraries loaded at run-time (i.e. from DLL's for so's)
79        @author
80            Adrian Cearn„u (cearny@cearny.ro)
81        @since
82            27 January 2002
83    */
84        class _OgreExport DynLib : public DynLibAlloc
85    {
86        protected:
87                String mName;
88        /// Gets the last loading error
89        String dynlibError(void);
90    public:
91        /** Default constructor - used by DynLibManager.
92            @warning
93                Do not call directly
94        */
95        DynLib( const String& name );
96
97        /** Default destructor.
98        */
99        ~DynLib();
100
101        /** Load the library
102        */
103        void load();
104        /** Unload the library
105        */
106        void unload();
107                /// Get the name of the library
108                const String& getName(void) const { return mName; }
109
110        /**
111            Returns the address of the given symbol from the loaded library.
112            @param
113                strName The name of the symbol to search for
114            @return
115                If the function succeeds, the returned value is a handle to
116                the symbol.
117            @par
118                If the function fails, the returned value is <b>NULL</b>.
119
120        */
121        void* getSymbol( const String& strName ) const throw();
122
123    protected:
124
125        /// Handle to the loaded library.
126        DYNLIB_HANDLE mInst;
127    };
128        /** @} */
129        /** @} */
130
131}
132
133#include "OgreHeaderSuffix.h"
134
135#endif
Note: See TracBrowser for help on using the repository browser.