24 lines
862 B
C++
24 lines
862 B
C++
// ANSGpuFrameRegistry.cpp — Cross-DLL singleton resolver for ANSOCR.dll.
|
|
//
|
|
// Finds the canonical ANSGpuFrameRegistry 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 "ANSGpuFrameRegistry.h"
|
|
|
|
ANSGpuFrameRegistry* ANSGpuFrameRegistry::resolveProcessWide() {
|
|
// ANSCV.dll is always loaded before inference starts (it provides RTSP).
|
|
HMODULE hMod = GetModuleHandleA("ANSCV.dll");
|
|
if (hMod) {
|
|
typedef ANSGpuFrameRegistry* (*GetInstanceFn)();
|
|
auto fn = reinterpret_cast<GetInstanceFn>(
|
|
GetProcAddress(hMod, "ANSGpuFrameRegistry_GetInstance"));
|
|
if (fn) return fn();
|
|
}
|
|
// Fallback: local instance (unit tests without ANSCV.dll).
|
|
static ANSGpuFrameRegistry local;
|
|
return &local;
|
|
}
|