P
Pravin
I have a function as follows in managed c++.
public foo( object *objectValue)
{
// pseudo code below, as I don't have exact code at this very moment.
if( type of objectValue is int)
{
objectValue = objectValue * 2;
}
elseif(type of objectValue is short)
{
objectValue = objectValue * 3;
}
// This function does some more processing after this.
}
I wish to call above function from C#.
To say it briefly, from C# I wish to pass 'int' and 'short' type of objects
to a function in managed c++. Managed c++ code will alter the value. The
changed value should be available to me in C# code.
The problem: In C# if I call the above as:
int i = 10;
foo(ref i);
The above code gives me compilation error. If I do boxing, unboxing in c#
code to pass parameter, then the changed value is not reflected back in C#
function.
I request to please guide, how to achieve it? Thanks.
public foo( object *objectValue)
{
// pseudo code below, as I don't have exact code at this very moment.
if( type of objectValue is int)
{
objectValue = objectValue * 2;
}
elseif(type of objectValue is short)
{
objectValue = objectValue * 3;
}
// This function does some more processing after this.
}
I wish to call above function from C#.
To say it briefly, from C# I wish to pass 'int' and 'short' type of objects
to a function in managed c++. Managed c++ code will alter the value. The
changed value should be available to me in C# code.
The problem: In C# if I call the above as:
int i = 10;
foo(ref i);
The above code gives me compilation error. If I do boxing, unboxing in c#
code to pass parameter, then the changed value is not reflected back in C#
function.
I request to please guide, how to achieve it? Thanks.