As per my previous post I think you need 'int __gc&' to make it a managed
reference. 'int&' is an unmanaged reference which is basically an unmanaged
pointer - hence the compiler complaint about int*.
"Lee Crabtree" <lc*******@goisi.com> wrote in message
news:OD**************@TK2MSFTNGP10.phx.gbl...
Lee Crabtree wrote: I'm trying to pass a variable by reference from a C# program to a managed
C++ wrapper. Something like this:
------------C++--------------
void GimmeByRef(int &reference);
-----------------------------
------------C#---------------
GimmeByRef(ref referenceVariable);
-----------------------------
However, I keep getting errors relating to not being able to convert 'ref
uint' to 'uint*'. What am I doing wrong?
Lee Crabtree
Well, trying an IntPtr didn't do any good. Converting a 'ref
System.IntPtr' to an 'int*' doesn't work any better than before.
I think the problem is somehow related to the fact that 'ref' in C#
doesn't equate to '&' in C++. What's the managed C++ equivalent of the
'ref' keyword?
Lee Crabtree