Answer the question
In order to leave comments, you need to log in
Bundle of Delphi 7 and С++(DLL). Change structure by reference
There is a structure in Delphi:
type
RESPONSE =packed Record
datetime:PChar;
code:PChar;
response_string:PChar;
end;
var
resp:RESPONSE;
struct RESPONSE {
char *datetime;
char *code;
char *string;
};
function getResponse(resp:PRESPONSE):Integer; cdecl ; external 'TestDLL.dll' name 'EF_getResponse';
DLLEXPORT void getResponse(RESPONSE *resp);
getResponse(Addr(resp));
resp->datetime="Test datetime";
resp->datetime=(char*)element->GetText();
const char * GetText();
Answer the question
In order to leave comments, you need to log in
You can’t just take and cast everything in a row. First you need to at least copy the data pointed to by the result of the GetText() call. And yes, struct RESPONSE is not C++ at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question