I have a legacy Delphi dll which requires a json string as input (pAnsiChar) and returns an int as success or failure. I have managed to connect to the dll from nodejs using node-ffi. However, i am getting return int value points to invalid json string.
Could someone point me in the direction as to how to call a Delphi dll with pAnsiChar as function arguments from node
Thanks
PAnsiChar
in Delphi is achar*
in C/C++. In the FFI declaration for the DLL function, simply declare thePAnsiChar
parameter as a"string"
, which is a null-terminated char* in FFI.For example, given this Delphi function:
The node.js code would look something like this: