PAnsiChar
in Delphi is a char*
in C/C++. In the FFI declaration for the DLL function, simply declare the PAnsiChar
parameter as a "string"
, which is a null-terminated char* in FFI.
For example, given this Delphi function:
function ProcessJson(Json: PAnsiChar): Integer; stdcall;
The node.js code would look something like this:
var ffi = require('ffi');
var mydll = ffi.Library('mydll', {
'ProcessJson': [ 'int', [ 'string' ] ]
});
var ret = mydll.ProcessJson("json content here");