#pragma once #include #include #include namespace voidlibc::loader::windows_handoff { struct LoadResult { void* handle = nullptr; // opaque OS handle (HMODULE on Windows) std::string error; bool ok = true; }; // Write `bytes` to a temp file and load it via LoadLibraryEx (Windows) / // dlopen from a temp file (stub for non-Windows builds so the code compiles // everywhere). The temp file is deleted once the DLL is loaded. LoadResult load_pe_buffer(const std::vector& bytes); // Resolve a symbol from a handle returned by load_pe_buffer. void* get_proc(void* handle, const char* name); // Unload a handle returned by load_pe_buffer. void unload(void* handle); } // namespace voidlibc::loader::windows_handoff