neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit b02880593e281ce44661ce22e9391edfe921e47e
parent 4e4203f71b0b9bb2ca4ad9abd2fbf4ea1deaf9a6
Author: luukvbaal <31730729+luukvbaal@users.noreply.github.com>
Date:   Thu, 23 Mar 2023 12:58:50 +0100

build(win): export extern symbols for use in FFI #22756

Makes `extern` variables accessible through ffi on Windows.

Follow-up to https://github.com/neovim/neovim/pull/15999
Diffstat:
Msrc/nvim/main.c | 7++++++-
Mtest/functional/lua/ffi_spec.lua | 9+++++++++
2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/nvim/main.c b/src/nvim/main.c @@ -1,7 +1,12 @@ // This is an open source non-commercial project. Dear PVS-Studio, please check // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -#define EXTERN +// Make sure extern symbols are exported on Windows +#ifdef WIN32 +# define EXTERN __declspec(dllexport) +#else +# define EXTERN +#endif #include <assert.h> #include <limits.h> #include <msgpack/pack.h> diff --git a/test/functional/lua/ffi_spec.lua b/test/functional/lua/ffi_spec.lua @@ -63,5 +63,14 @@ describe('ffi.cdef', function() nil ) ]=]) + + -- Check that extern symbols are exported and accessible + eq(true, exec_lua[[ + local ffi = require('ffi') + + ffi.cdef('uint64_t display_tick;') + + return ffi.C.display_tick >= 0 + ]]) end) end)