简体   繁体   English

如何从C应用程序运行erlang?

[英]How to run erlang from c application?

is it possible to run erlang vm from withing C application? 是否可以通过C应用程序运行erlang vm? I'd like to use as script engine from my game and cannot find any erlang API or other "official" way how to do that ... 我想从我的游戏中用作脚本引擎,却找不到任何erlang API或其他“官方”方式来做到这一点...

Thanks! 谢谢!

Erlang VM takes some time to boot, so it wouldn't make sense to start and stop it each time, you want to make a call. Erlang VM需要花费一些时间来启动,因此每次要拨打电话时启动和停止它都没有意义。 The only solution is to have it running all the time (it is not that heavy). 唯一的解决方案是让它一直运行(这并不那么麻烦)。 You can communicate with your C code using raw TCP or C nodes. 您可以使用原始TCP或C节点与C代码进行通信。 You can read more about different interoperability options here: 您可以在此处阅读有关不同互操作性选项的更多信息:

http://www.erlang.org/doc/tutorial/users_guide.html http://www.erlang.org/doc/tutorial/users_guide.html

Erlang is good for orchestration, while C++ is good for raw computation, so usually people do it the other way round: they call C from Erlang. Erlang适用于编排,而C ++适用于原始计算,因此通常人们以相反的方式进行操作:他们从Erlang调用C。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM