I have a Win32 C++ DLL that needs to pass multiple parameters of type long back to the calling application (C#)
It is using DllImport to declare them
On the C++ side, they are declared a
long myDLLFunc(...,long& mypassbackparam1,...) {...} (i.e. a not a pointer, but by reference
Then, the DLL just assigns a value , sa
mypassbackparam1 = 42
On the C# side, they are declared as 'out long'. (Not 'ref long')
The C# program simply declares them, sets them to zero, passes them, and then reads them back
It seems to work
I was just wondering though, is this the correct way to do it?