diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-10-17 23:58:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-17 23:58:14 +0200 |
commit | ffc28dcbdb0d3ea7f1f70d1f9627d423f950d224 (patch) | |
tree | 6b58b54af6095b8d09c5c5dc6654af0892d83dc5 /src | |
parent | 8f9f127274fb5e715645f88fe8e76f4a7ca8ca10 (diff) | |
parent | aa644b7fd3ba195ed101b8afc4c599050160cc79 (diff) | |
download | rneovim-ffc28dcbdb0d3ea7f1f70d1f9627d423f950d224.tar.gz rneovim-ffc28dcbdb0d3ea7f1f70d1f9627d423f950d224.tar.bz2 rneovim-ffc28dcbdb0d3ea7f1f70d1f9627d423f950d224.zip |
Merge pull request #15999 from famiu/fix/build/export-windows-symbols
fix(build): export symbols on Windows
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/generators/c_grammar.lua | 2 | ||||
-rwxr-xr-x | src/nvim/generators/gen_declarations.lua | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/nvim/generators/c_grammar.lua b/src/nvim/generators/c_grammar.lua index a5f76e1c6a..f35817c466 100644 --- a/src/nvim/generators/c_grammar.lua +++ b/src/nvim/generators/c_grammar.lua @@ -16,6 +16,7 @@ local ws = S(' \t') + nl local fill = ws ^ 0 local c_comment = P('//') * (not_nl ^ 0) local c_preproc = P('#') * (not_nl ^ 0) +local dllexport = P('DLLEXPORT') * (ws ^ 1) local typed_container = (P('ArrayOf(') + P('DictionaryOf(') + P('Dict(')) * ((any - P(')')) ^ 1) * P(')') local c_id = ( @@ -33,6 +34,7 @@ local c_param = Ct(c_param_type * C(c_id)) local c_param_list = c_param * (fill * (P(',') * fill * c_param) ^ 0) local c_params = Ct(c_void + c_param_list) local c_proto = Ct( + (dllexport ^ -1) * Cg(c_type, 'return_type') * Cg(c_id, 'name') * fill * P('(') * fill * Cg(c_params, 'parameters') * fill * P(')') * Cg(Cc(false), 'fast') * 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 |