In response to this question on Skype:
Does anyone have an example of calling a method in a .Net Assembly with in an out arguments?
I was, once again, reminded of the awesome ClarionLive webinar and examples by @hdsoftware.
Note that ref
is not the same as in
and out
but maybe this will give you some ideas to start with!
Specifically Clarion and .NET\DotNet\Clarion vs Net\DLLForClarion\Classes\DateTimeManager.cs
where he has this example:
[DllExport(CallingConvention = CallingConvention.StdCall, ExportName = "NET_PassingByAddress")]
public static void NET_PassingByAddress([MarshalAs(UnmanagedType.BStr)] ref string passedByAddress)
{
passedByAddress = passedByAddress.ToUpper();
}
and on the Clarion side is this:
MESSAGE('Reversing the string |' & StringToPass & '|' & st_DatemanagerWrapper.st_PassingStringReturnString(StringToPass))
st_DatemanagerWrapper.st_PassingByAddress(StringToPass)
MESSAGE('Changing the string by address|After call:|' & StringToPass)