From aa644b7fd3ba195ed101b8afc4c599050160cc79 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Tue, 12 Oct 2021 21:10:47 +0600 Subject: fix(build): export symbols on Windows Closes https://github.com/neovim/neovim/issues/15063 Allows using Neovim core functions using LuaJIT FFI on Windows. --- src/nvim/generators/gen_declarations.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/nvim/generators/gen_declarations.lua') diff --git a/src/nvim/generators/gen_declarations.lua b/src/nvim/generators/gen_declarations.lua index 97491679a4..c7d5a1a191 100755 --- a/src/nvim/generators/gen_declarations.lua +++ b/src/nvim/generators/gen_declarations.lua @@ -216,7 +216,16 @@ local footer = [[ #include "nvim/func_attr.h" ]] -local non_static = header +local non_static = header .. [[ +#ifndef DLLEXPORT +# ifdef WIN32 +# define DLLEXPORT __declspec(dllexport) +# else +# define DLLEXPORT +# endif +#endif +]] + local static = header local filepattern = '^#%a* (%d+) "([^"]-)/?([^"/]+)"' @@ -269,6 +278,7 @@ while init ~= nil do declaration = declaration:gsub(' $', '') declaration = declaration:gsub('^ ', '') declaration = declaration .. ';' + if os.getenv('NVIM_GEN_DECLARATIONS_LINE_NUMBERS') == '1' then declaration = declaration .. (' // %s/%s:%u'):format( curdir, curfile, declline) @@ -277,6 +287,7 @@ while init ~= nil do if declaration:sub(1, 6) == 'static' then static = static .. declaration else + declaration = 'DLLEXPORT ' .. declaration non_static = non_static .. declaration end declendpos = e -- cgit