Files
NazaraEngine/include/Nazara/Core/DynLib.hpp
Lynix 505f1dbb03 Merge branch 'master' into NDK
Conflicts:
	include/Nazara/Core/Algorithm.inl
	include/Nazara/Core/ByteArray.hpp
	include/Nazara/Math/Algorithm.inl
	src/Nazara/Graphics/SkyboxBackground.cpp

Former-commit-id: 42f52f71989fa805f69527fd07edb8405df06566
2015-08-21 18:55:58 +02:00

59 lines
1.3 KiB
C++

// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_DYNLIB_HPP
#define NAZARA_DYNLIB_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/NonCopyable.hpp>
#include <Nazara/Core/String.hpp>
#if defined(NAZARA_PLATFORM_WINDOWS)
#define NAZARA_DYNLIB_EXTENSION ".dll"
#elif defined(NAZARA_PLATFORM_LINUX)
#define NAZARA_DYNLIB_EXTENSION ".so"
#elif defined(NAZARA_PLATFORM_MACOSX)
#define NAZARA_DYNLIB_EXTENSION ".dynlib"
#else
#error OS not handled
#endif
#if NAZARA_CORE_THREADSAFE && NAZARA_THREADSAFETY_DYNLIB
#include <Nazara/Core/ThreadSafety.hpp>
#else
#include <Nazara/Core/ThreadSafetyOff.hpp>
#endif
using NzDynLibFunc = int (*)(); // Type "générique" de pointeur sur fonction
class NzDynLibImpl;
class NAZARA_CORE_API NzDynLib : NzNonCopyable
{
public:
NzDynLib();
NzDynLib(NzDynLib&& lib);
~NzDynLib();
NzString GetLastError() const;
NzDynLibFunc GetSymbol(const NzString& symbol) const;
bool IsLoaded() const;
bool Load(const NzString& libraryPath);
void Unload();
NzDynLib& operator=(NzDynLib&& lib);
private:
NazaraMutexAttrib(m_mutex, mutable)
mutable NzString m_lastError;
NzDynLibImpl* m_impl;
};
#endif // NAZARA_DYNLIB_HPP