Where you write
error = GetRequestResult(code);
you need to write
error = GetRequestResult(out code);
which is precisely what the second error message states.
Looking at your code, returning a PChar
from the Delphi DLL the way that you do is not compatible with your P/invokes. The P/invoke marshaller is assuming that your return values were allocated with CoTaskMemAlloc
and will call CoTaskMemFree
on the pointer that you return. That's going to lead to some problems somewhere down the line. I think you'll need to tackle that issue at some point but since it's not the subject of this question, I won't attempt to solve the problem here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.