// ANSGpuFrameRegistry.cpp — Process-wide singleton, compiled into ANSCV.dll.
//
// On Windows, header-only singletons (static local in inline function) create
// separate instances in each DLL. Since gpu_frame_attach() runs in ANSCV.dll
// and gpu_frame_lookup() runs in ANSODEngine.dll, we need a single shared
// instance. This file:
//   1. Defines resolveProcessWide() which owns the canonical singleton.
//   2. Exports a C function so other DLLs can find it via GetProcAddress.

#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#include "ANSGpuFrameRegistry.h"

// ANSCV.dll owns the process-wide singleton.
ANSGpuFrameRegistry* ANSGpuFrameRegistry::resolveProcessWide() {
    static ANSGpuFrameRegistry reg;
    return &reg;
}

// Exported so other DLLs (ANSODEngine, etc.) can find this instance at runtime.
extern "C" __declspec(dllexport)
ANSGpuFrameRegistry* ANSGpuFrameRegistry_GetInstance() {
    return &ANSGpuFrameRegistry::instance();
}
