node-ffi-napi / node-ffi-napi

A foreign function interface (FFI) for Node.js, N-API style
MIT License
1k stars 147 forks source link

Add support for Windows on ARM (AArch64) #59

Open christopher-rtf opened 4 years ago

christopher-rtf commented 4 years ago

node-ffi-napi currently embeds libffi-3.0.11 which predates Windows on ARM (AArch64).

To support Windows on ARM64, node-ffi-napi will probably need two individual updates (in this order): (1) update node-ffi-napi to libffi-3.3 (with any ffi.cc/ff.h file updates necessary to suppor libffi-3.3) (2) for WoA: update the node-gyp and ffi.cc/ffi.h files to support Windows on ARM (AArch64)

I have done some preliminary testing, and I am able to basically just replace libffi-3.0.11 with libffi-3.3 in the /deps/libffi folder (while keeping the existing node-gyp file). I did need to patch up the libffi header paths when building either via "npm install" or with VS2017 generally...but libffi's main project (ffi) compiles without incident.

Note: the libffi-3.3 update was already opened as in issue; this is not intended to be a duplicate issue. https://github.com/node-ffi-napi/node-ffi-napi/issues/47

I have not spent any time with AArch64 at a low level, but unless Microsoft is using significantly differently calling conventions for AArch64 we could ideally reuse some of the work already done here: https://github.com/node-ffi-napi/node-ffi-napi/issues/45

EwoutH commented 3 years ago

I think I'm encountering the same error.