Add template-like get method in class SharedLibrary

This commit is contained in:
Kirigaya Kazuto 2017-05-31 22:30:10 +08:00
parent d450ce8636
commit d8e8deb031

View File

@ -478,6 +478,13 @@ namespace MiniEngine
~SharedLibrary();
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);
void release();
private: