G
Guest
Hello,
In the MC++ FAQ, we can find how to map a C# "out int" argument to managed
C++. The following solution used to work, in previous version of VS, but
fails with VC# and VC++ Express:
// TestOutInt.h
#pragma once
using namespace System;
using namespace System::Runtime::InteropServices;
namespace TestOutInt {
public ref class Class1
{
public:
void SomeFunc( [Out]Int32 * arg)
{
*arg = 2;
}
};
}
// C# code
using System;
using System.Collections.Generic;
using System.Text;
using TestOutInt;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int test;
Class1 c = new Class1();
c.SomeFunc(out test);
Console.WriteLine(test.ToString());
}
}
}
It splits out the error: Argument '1': cannot convert from 'out int' to 'int*'
As mentioned the equivalent code used to work in previous version.
What am I misssing here?
-daniel
In the MC++ FAQ, we can find how to map a C# "out int" argument to managed
C++. The following solution used to work, in previous version of VS, but
fails with VC# and VC++ Express:
// TestOutInt.h
#pragma once
using namespace System;
using namespace System::Runtime::InteropServices;
namespace TestOutInt {
public ref class Class1
{
public:
void SomeFunc( [Out]Int32 * arg)
{
*arg = 2;
}
};
}
// C# code
using System;
using System.Collections.Generic;
using System.Text;
using TestOutInt;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int test;
Class1 c = new Class1();
c.SomeFunc(out test);
Console.WriteLine(test.ToString());
}
}
}
It splits out the error: Argument '1': cannot convert from 'out int' to 'int*'
As mentioned the equivalent code used to work in previous version.
What am I misssing here?
-daniel