Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
build(win): export extern symbols for use in FFI
  • Loading branch information
luukvbaal committed Mar 23, 2023
commit 452192c2efc3997f43b5d376499d71dac33d51a8
7 changes: 6 additions & 1 deletion src/nvim/main.c
Original file line number Diff line number Diff line change
@@ -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:https://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>
Expand Down
9 changes: 9 additions & 0 deletions test/functional/lua/ffi_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)