Files
ANSCORE/modules/ANSLPR/GpuNV12SlotPool.cpp

24 lines
836 B
C++
Raw Normal View History

// GpuNV12SlotPool.cpp — Cross-DLL singleton resolver for ANSODEngine.dll.
//
// Finds the canonical GpuNV12SlotPool instance exported by ANSCV.dll
// via GetProcAddress. No link dependency on ANSCV.lib needed.
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#include "GpuNV12SlotPool.h"
GpuNV12SlotPool* GpuNV12SlotPool::resolveProcessWide() {
// ANSCV.dll is always loaded before inference starts (it provides RTSP).
HMODULE hMod = GetModuleHandleA("ANSCV.dll");
if (hMod) {
typedef GpuNV12SlotPool* (*GetInstanceFn)();
auto fn = reinterpret_cast<GetInstanceFn>(
GetProcAddress(hMod, "GpuNV12SlotPool_GetInstance"));
if (fn) return fn();
}
// Fallback: local instance (unit tests without ANSCV.dll).
static GpuNV12SlotPool local;
return &local;
}