:O
- Joined
- Jun 23, 2006
- Messages
- 782
- Reaction score
- 399
Made by Sun aka Kealy(Published in NWK source).
"Modified" by meeeeh.
This is by far better as to use a dll which is 400 kb big and has just these few lines...
You can also create a simple proxy dll and just copy the function IPlugins::Load...
"Modified" by meeeeh.
Code:
class IPlugins
{
public:
IPlugins();
void Load();
}
IPlugins Plugins;
IPlugins::IPlugins()
{
this->Load();
}
void IPlugins::Load()
{
// Loading modules in ./dlls/
std::wstring Path = L"./dlls/";
WIN32_FIND_DATA DataFound;
HANDLE hFind = INVALID_HANDLE_VALUE;
CreateDirectory(Path.c_str(), NULL);
Path += L"*.dll";
hFind = FindFirstFile(Path.c_str(), &DataFound);
if (hFind != INVALID_HANDLE_VALUE)
{
do
{
if (!(DataFound.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
// found a dll, let's load it.
std::wstring FullName = L"./dlls/" + (std::wstring)DataFound.cFileName;
LoadLibrary(FullName.c_str());
}
} while (FindNextFile(hFind, &DataFound));
}
FindClose(hFind);
}
This is by far better as to use a dll which is 400 kb big and has just these few lines...
You can also create a simple proxy dll and just copy the function IPlugins::Load...
Last edited: