简体   繁体   中英

Errors calling delphi .dll from unity3d c#

I got following errors when tried to calling .dll (made from delphi) function from unity3d C# code.

Here is pictures,

在此处输入图片说明

and errors says,

在此处输入图片说明

and .dll codes are,

在此处输入图片说明

So why error occurs and how to solve?

Thanks a lot!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM