From 08f113a0bf3638cb45be67e663457f8eb50cc2f1 Mon Sep 17 00:00:00 2001 From: Kris Zyp Date: Tue, 10 May 2022 08:41:58 -0600 Subject: [PATCH] Start re-enabling some extern functions for Bun FFI --- src/dbi.cpp | 6 ++++++ src/lmdb-js.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/dbi.cpp b/src/dbi.cpp index bb5d28261..975b8009b 100644 --- a/src/dbi.cpp +++ b/src/dbi.cpp @@ -172,6 +172,12 @@ NAPI_FUNCTION(getByBinary) { GET_UINT32_ARG(keySize, 1); RETURN_INT32(dw->doGetByBinary(keySize)); } + +extern "C" EXTERN uint32_t dbiGetByBinary(double dwPointer, uint32_t keySize) { + DbiWrap* dw = (DbiWrap*) (size_t) dwPointer; + return dw->doGetByBinary(keySize); +} + napi_finalize noopDbi = [](napi_env, void *, void *) { // Data belongs to LMDB, we shouldn't free it here }; diff --git a/src/lmdb-js.h b/src/lmdb-js.h index 3012c2d46..9c8d3a0d8 100644 --- a/src/lmdb-js.h +++ b/src/lmdb-js.h @@ -40,6 +40,12 @@ using namespace Napi; #ifndef __CPTHREAD_H__ #define __CPTHREAD_H__ +#ifdef _WIN32 +#define EXTERN __declspec(dllexport) +# else +#define EXTERN __attribute__((visibility("default"))) +#endif + #ifdef _WIN32 # include #else