I had a managed c++ function that would take for one of its arguments a double value passed in as a reference.
void MCppFunctions::ChangeValue (double &dValue)
{...}
So how does one call a function like this from c#.
If you try the obvious method MCppFunctions.ChangeValue(ref dValue), you will get a compile error.
To fix this problem, all you need to do is change the cpp function definition to the following:
void MCppFunctions::ChangeValue(double __gc & dValue)
Once thats done you can call the function from c# and pass in the value and qualifying the parameter with the ref keyword.
No comments:
Post a Comment