Marahsaling 'out long'

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top