Files
2026-10-29 09:15:34 -04:00

33 lines
1.0 KiB
Lua

-- glacier_ffi.lua
--
-- The test suite's handle on libglacier-ng. A thin wrapper over
-- lib/glacier_cdef.lua, the single source of truth for every ffi.cdef()
-- declaration. This file used to carry its own copy of all of them, and
-- had already drifted (it was missing GL_INSTALL_ERR_SCOPE) — the exact
-- duplication bug CLAUDE.md describes. Don't add declarations here; add
-- them to lib/glacier_cdef.lua.
--
-- Usage:
-- local glacier = require("glacier_ffi")
-- local ctx = glacier.new_context()
-- glacier.lib.gl_init_live_context(ctx, glacier.SCOPE_USR, 1000)
--
-- The combined .so is loaded by glacier_cdef.load(): LIBGLACIER_SO if
-- set, else <project>/lib/glacier/libglacier-ng.so.
-- lib/ lives one level up from tests/, wherever this is run from.
local here = (debug.getinfo(1, "S").source:match("^@(.*/)") or "./")
package.path = here .. "../?.lua;" .. package.path
local ffi = require("ffi")
local cdef = require("lib/glacier_cdef")
local M = {}
for k, v in pairs(cdef) do M[k] = v end
M.ffi = ffi
M.C = ffi.C
M.lib = cdef.load()
return M