aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/sourceinterface.cpp
blob: 49a2f164f97da6a80c2a5d1601a14d2bd62cd0f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "pch.h"
#include "sourceinterface.h"
#include <string>
#include "tier0.h"

template<typename T> SourceInterface<T>::SourceInterface(const std::string& moduleName, const std::string& interfaceName)
{
    HMODULE handle = GetModuleHandleA(moduleName.c_str());
    CreateInterfaceFn createInterface = (CreateInterfaceFn)GetProcAddress(handle, interfaceName.c_str());
    m_interface = (T*)createInterface(interfaceName.c_str(), NULL);
    if (m_interface == nullptr)
        Error("Failed to call CreateInterface for %s in %s", interfaceName, moduleName);
}