Using Static/Shared C Libraries in Higher Level Languages [closed]

寵の児 提交于 2020-01-23 13:04:40

问题


I'm wondering if there is some way to take my custom shared/static libraries, made in C, and use them into another higher language such as python or node.js.

I came with this because I'm writing a few libraries to calculate some math stuff. I heard about node.js not being so good for heavy calculations (but is for networking I/O).

Hence, I'm really thinking on spend some time in find a way to make nodejs to use my C libraries in smart way. I mean, I want to make nodejs delegate the heavy calculations to C, and get the answers back somehow.

But I'm accepting any good advice about using some other higher level languages (or tools) that does the job. Any scenario rather than those I said will be appreciated.

Edit:

I Just Found this question in stackoverflow that got my attetion. I'll try it for now.


回答1:


There are not many cases where you would want to do that. I recently tested some heavy math calculations on my pc and on an embedded linux system following Derek Molloy's code from https://github.com/derekmolloy/exploringBB/tree/master/chp05/performance . And I found out node.js does the job in just twice the time C++ (optimized) takes. So this may not be worth your while.



来源:https://stackoverflow.com/questions/32148712/using-static-shared-c-libraries-in-higher-level-languages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!