Skip to content

native modules #4

Description

@lukaskollmer

In your announcement blog post you write

JavaScript code can also make direct synchronous calls into native code (Java, Objective C, Swift) and get calls back from it, by means of Node’s native add-on APIs (the V8 API and N-API are both available).

How does this work exactly?
I'm trying to use the ffi on iOS. I ship my own node_modules folder, which I add to process.env.NODE_PATH at runtime.

The issue is that node-gyp simply didn't build the native modules for arm64 in the first place.

const ffi = require('ffi');

throws the following error:

dlopen(PATH_TO_APP/Frameworks/NodeJSKit.framework/node_modules/ref/build/Release/binding.node, 1): no suitable image found.  Did find:
	PATH_TO_APP/Frameworks/NodeJSKit.framework/node_modules/ref/build/Release/binding.node: mach-o, but wrong architecture
	PATH_TO_APP/Frameworks/NodeJSKit.framework/node_modules/ref/build/Release/binding.node: mach-o, but wrong architecture

Is it possible to build native node addons written in c++ (that use the v8 api or the newer N-API) to work with nodejs-mobile?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions