MiniEngine/include/SDLWrapper/SharedLibrary.h
kiritow d2d11aeec5 Update to SDL2.0.7, SDL_image 2.0.2
It seems that SDL_Mixer 2.0.2 is not built with any audio support.
No newer version of SDL_ttf found.
2017-12-31 17:57:20 +08:00

31 lines
784 B
C++

#pragma once
#include "include.h"
#include <string>
#include <memory>
#include <functional>
#include "begin_code.h"
class SharedLibrary
{
public:
SharedLibrary();
SharedLibrary(const std::string& Filename);
~SharedLibrary()=default;
int load(const std::string& Filename);
int unload();
template<typename ReturnType,typename... Arguments>
std::function<ReturnType(Arguments...)> get(const std::string& FunctionName)
{
return std::function<ReturnType(Arguments...)>(reinterpret_cast<ReturnType(*)(Arguments...)>(get(FunctionName)));
}
void* get(const std::string& FunctionName) const;
void release();
private:
void* _get() const;
void _set(void*);
void _clear();
std::shared_ptr<void> _obj;
};
#include "end_code.h"