public
Last active

attempt at using node-ffi, but node-ffi cannot find the symbols

  • Download Gist
main.cpp
C++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <stdint.h>
#include <QtCore/QtGlobal>
#if defined(MYSHAREDLIB_LIBRARY)
# define MYSHAREDLIB_EXPORT Q_DECL_EXPORT
#else
# define MYSHAREDLIB_EXPORT Q_DECL_IMPORT
#endif
 
MYSHAREDLIB_EXPORT uint64_t factorial(int max) {
int i = max;
uint64_t result = 1;
while (i >= 2)
result *= i--;
return result;
}
stackoverflow.js
JavaScript
1 2 3 4 5 6
var FFI = require('node-ffi')
,libstackoverflow = new FFI.Library("build/libstackoverflow", {
'factorial': [ 'uint64', [ 'int' ] ]
});
console.log(libstackoverflow.factorial(10));
stackoverflow.pro
IDL
1 2 3 4 5 6 7 8 9 10 11 12 13 14
######################################################################
# Automatically generated by qmake (2.01a) Wed Jun 8 21:28:16 2011
######################################################################
 
TEMPLATE = lib
DEFINES += MYSHAREDLIB_LIBRARY
CONFIG += qt dll
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
DESTDIR = ./build
 
# Input
SOURCES += main.cpp

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.