Skip to content

Bindgen equivalent #29

@codebycruz

Description

@codebycruz

This would be used with #28 and #1

-- build.lua file to create a types.lua file containing 
local bindgen = require("bindgen")

local bindings = bindgen.new()
    :withHeader("ffi.h")
    :generate()

local luaSource = bindings:asLua()

local outDir = os.getenv("LPM_OUTPUT_DIR")
local pathSep = string.sub(package.config, 1, 1)

local outFile = io.open(outDir .. pathSep .. "types.lua", "w")
outFile:write(preprocessed)
outFile:close()

Not specifically related to lpm but very useful for the project (and for Arisu / LuaJIT in general) since this would deduplicate LuaLS typings from LuaJIT C Header definitions. Plus, you'd be able to use actual C header files and get intellisense from there.

Ideally this wouldn't shell out and require a user to have a C preprocessor, but it only needs to run at build time so it doesn't matter too much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions