I have a windows c++ DLL. It provides some functions like add(1,2). But I don't have the source code for this DLL, is it possible call functions in this DLL through nodejs, I mean, through web side and http. If it possible, what should I do?
Asked
Active
Viewed 4.6k times
25
-
1Maybe you can find some useful infor from this question [http://stackoverflow.com/questions/9629677/how-can-i-use-a-c-library-from-node-js](http://stackoverflow.com/questions/9629677/how-can-i-use-a-c-library-from-node-js) – zangw May 27 '15 at 10:34
-
1Possible duplicate of [How can I use a C++ library from node.js?](http://stackoverflow.com/questions/9629677/how-can-i-use-a-c-library-from-node-js) – Software Engineer Feb 21 '17 at 09:49
1 Answers
1
Did you check out the ffi nodejs library? https://github.com/node-ffi/node-ffi
var ffi = require('ffi');
var libm = ffi.Library('libm', {
'ceil': [ 'double', [ 'double' ] ]
});
libm.ceil(1.5); // 2
Zsófi Ülkei
- 61
- 6
-
-
@Martian2049 could you explain why this isn't a good solution? It appears that this is a very popular library (15K weekly downloads). Could you elaborate on your comment? – Will Eccles Nov 12 '21 at 22:09
-
https://nodejs.org/api/addons.html @WillEccles check out this document if you haven't. it's more complicated approach but more reliable. – Martian2049 Nov 16 '21 at 05:17
-