Joke Collection Website - Blessing messages - How does node ffi call c++ class methods?

How does node ffi call c++ class methods?

Strict use'

/**

* SMS service module

* */

var FFI = require(' FFI ');

//int send _ msg (char * phone, char * content) c language interface.

var libm = ffi。 Library (__dirname+'/msgQ/libsend_msg',

{

send_msg': ['int ',['string ',' string']]

});

let smsExport = {

Send message (optional) {

let phone = opt.phone

let content = opt.text

//Call C interface to send SMS.

Let retcode = libm.send_msg (phone, content);

if (retcode === 0)

{

// TODO succeeded

}

Otherwise {

// TODO failed

}

}

};

module.exports = smsExport