summaryrefslogtreecommitdiff
path: root/scratch/nvim_ffi.lua
blob: 3a48ada937a6b2eb494aa862fb919281f916dd23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
local ffi = require("ffi")
-- ffi.load("/home/tj/build/neovim/build/include/eval/funcs.h.generated.h")

ffi.cdef [[
typedef unsigned char char_u;
char_u *shorten_dir(char_u *str);
]]

local text = "scratch/file.lua"
local c_str = ffi.new("char[?]", #text)
ffi.copy(c_str, text)

print(vim.inspect(ffi.string(ffi.C.shorten_dir(c_str))))