Calling "call-ny-reference c++ function" in C#


I have a call-by-refrence function in a managed c++ dll.

How do i call that function in C#?

I've tried this:

[managed c++ dll]
void myClass::myFunction(int &state, int &status)
status = 3;

int a,b
m_AUConnector.getStateInfo(ref a, ref b); //have tried without ref too.

but get the following error:
"can not convert from 'ref int' to 'int*'

How can i return the two params. from managed c++ to C#?


  • Hi

    The problem is in the Perameter signiture in the c++ prototype expects pointers.

    A pointer in C# is indecated with an *. int* is a pointer to an integer.

    The prototypes will have to be the same in both languages.
    Is the C++ function call returning 2 parameters? if not then you will have to overload this function in C++(My knowladge of C++ is ZERO so pardon me.)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion