I need to call a wrapped function from a C++ DLL with the following declaration:
[DllImport(@dllPath, EntryPoint = "Calling_fooBar")]
private static extern int Calling_fooBar( uint* a,
uint* b,
uint* c,
uint* d,
//etc );
Used in this way:
private void getData()
{
uint A, B, C, D; //etc
Calling_fooBar( &A, &B, &C, &D );
// ...
}
Upon doing this, A, B, C, D are all still 0. I'm quite sure the external method in the DLL is working properly so they should have non-zero values.
So I'm guessing I'm passing the address wrong ... or something.
Hopefully this isn't too dumb a question. I can clarify anything if needed
尝试将*
和&
更改为ref
。
Yes to Slaks above. Here's what my code which successfully does such things looks like:
[DllImport("blah.dll")]
private static extern int thingy( ref uint refArg );
/* ... later in the code. ...*/
int retVal = thingy( ref refVariable );
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.