非基于Web的JavaScript,调用C ++函数 [英] Non Web-Based JavaScript, call C++ function

查看:57
本文介绍了非基于Web的JavaScript,调用C ++函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿大家好我正在试图弄清楚如何从javascript调用C ++函数。我看到的每个地方,我只是得到基于网络的答案,这对我没有帮助。我正在研究一个在机器运行时运行javascript的程序,我需要这个脚本来调用C ++函数,但是无法弄清楚如何。有帮助吗?即使是最基本的答案,例如如何获得Hello world等。运行C ++函数就足够了。谢谢!

解决方案

JavaScript在哪里运行?在浏览器中或(如node.js)在控制台中?


如果JS在浏览器中运行,则不能直接调用C ++函数。你必须进行往返并调用一个为你运行该函数的服务器脚本。


它在控制台中运行。一旦机器开始运行,它就会执行一个处理信息的xxx.js文件。计算机上没有迹象表明发生了任何事情。我只需要这个.js来调用一些C ++函数。


然后它取决于你的JS主机提供的文件系统API。


但即使这样,你也只能调用一个运行C ++的app /脚本。 JS无法直接调用另一种语言的函数。


Hey everyone. I''m trying to figure out how to call a C++ function from javascript. Everywhere I look, I''m just getting web-based answers and that won''t help me. I''m working on a program that runs javascript while a machine is running, and I need this script to call a C++ function along the way, but can''t figure out how. Any help? Even the most basic answer such as how to get a "Hello world" C++ funtion to run will be sufficient. Thanks!

解决方案

where does the JavaScript run? in a browser or (like node.js) in the console?

if the JS runs in a browser, you can?t call a C++ function directly. you have to take a roundtrip and call a server script that runs the function for you.


It runs in the console. Once a machine starts running, it executes a xxx.js file which processes the information. There is no indication on the computer that anything is happening at all. I just need this .js to call on some C++ functions.


then it depends on the File System API that your JS host provides.

but even then, you can only call an app/script that runs the C++ for you. there is no way for JS to directly call another language’s function.


这篇关于非基于Web的JavaScript,调用C ++函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆