0

Is there a way to call a c++ library from javascript code inside both a browser and node.js? Ideally, the code to invoke a function call in the library is the same for both cases. It's acceptable if the approach only supports Chrome for a browser. I've found approaches that support either the browser or node.js, but not both. Thanks.

Edit: To clarify, I have a pure javascript codebase that runs both server-side (node) and client-side (browser) and I want the c++ library to be callable from this codebase for both cases.

1 Answer 1

1

With NaCl its possible to message a C++ extention with javascript. This requires you to basically develop a chrome extenstion/app, I doubt you can access the C++ library from code outside of the extension however, unless you implement said feature.

On node you can wrap c++ objects, but these approaches are different.

If you wanted to have a uniform way to do this you could develop a middleware to handle that, but thats a project in its own.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.