I currently have a Delphi DLL which takes in 2 parameters as PChar and another parameter that outputs as a PChar to Excel. In Excel these are all string, but whenever I run the macro in Excel, my Excel crashes and restarts.
This is what is in Delphi:
procedure P_GERGDLL(T, rho: double;NID: integer;KIDstr,Xstr:PChar;var Z,P,dP_dT,dP_drho,dP_dV,dV_dT,drho_dT: double;var XXstr:PChar; var ier: integer); stdcall;
This is what is in VBA:
Declare PtrSafe Sub P_GERGDLL Lib "C:\Users\louis chapoy\test DLL\Win64\Debug\ThermophiDLL.dll" _
(ByVal T As Double, ByVal rho As Double, ByVal NID As Integer, ByVal KSTR As String, _
ByVal Xstr As String, ByRef Z As Double, ByRef P As Double, ByRef dpdt As Double, _
ByRef dpdr As Double, ByRef dpdv As Double, ByRef dvdt As Double, ByRef drdt As Double, ByRef XXstr As String, ByRef ier As Integer)
P_GERGDLL T, rho, NZ, KIDstr, Xstr, Z, PP, dpdt, dpdr, dpdv, dvdt, drdt, XXstr, ier
I feel like I have tried everything to get this to work, and no matter what different variable types I use it always crashes. They are both 64-bit, and the file locations are correct. I have shareMem at the top of my uses clause.
WideStringinstead ofPChar?