VB Calling Delphi
Posted on 2001-07-31
I have a VB DLL that is calling a Delphi DLL to retrieve a string. It seems to work fine with short strings but every once and a while with a longer string (> 255) I get an exception and the VB app crashes.
The Delphi function is defined as follows:
function WebSessionStatus(pSession, D: string): string; stdcall;
It returns the string as follows:
S := S + '~#@#@'
p := StrAlloc(length(S) + 1);
Result := StrPCopy(P,S);
Is it the definition of string that is causing my problem?
How can this be done so that the function works correctly every time?