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
stdcall
functions. My belief is that node-ffi can only callcdecl
functions. You accepted Remy's answer which leads me to believe that you have extra information about node-ffi that informs you that node-ffi can in fact callstdcall
functions. I suppose it is plausible that node-ffi could add some extra code to detect whether or not the callee tidied up the stack and adapt accordingly. What information do you have? – David Heffernancdecl
. Your function isstdcall
. I presume you read my answer explaining that. You accepted Remy's without commenting on mine. Which I can only assume means that you have information that says that node-ffi supportsstdcall
. – David HeffernanDeclare Function JSCall Lib "NETCDFLIB.DLL" (ByVal Req As String, ByVal RetBuf As String, ByVal RetBufLen As Long) As Long
and according to the doco i have, it is a stdcall dll. This dll is used to extract NetCDF data in json format. Unfortunately, in my original email i failed to indicate that it is a stdcall dll and infact, i thought nodejs can only call stdcall dlls only on windows hence not mentioning. Having said that, i was able to get function return call (an int value) which indicated that the req string passed to the dll was invalid jscall hence call for help. – user3234437