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?
Mattias Sj?gren - 14 May 2004 11:51 GMT
>I was just wondering though, is this the correct way to do it?
C# long != C++ long. You should use an int on the C# side.
Other than that it should be fine.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.