Hard to say if you don't post the whole code, but I guess you have defined
Point in the MyName namespace too.
Following works for me:
// File: point.cpp
// Compile with : CL /clr /LD point.cpp
public __gc class Point
{
public:
Point(int p1, int p2)
{
v1 = p1;
v2 = p2;
}
private:
int v1;
int v2;
};
public __gc class Line
{
public:
Line(Point* p1, Point* p2)
{}
// File: test.cs
// Compiler command : csc /r:point.dll test.cs
using System;
namespace MyName
{
class Tester
{
static void Main()
{
Point p1, p2;
p1 = new Point(1,1);
p2 = new Point(2,2);
Line l = new Line(p1, p2);
}
}
}
Willy.
"Thomas" <ad***@versanet.de> wrote in message
news:41********@olaf.komtel.net...
I can't call a method with managed(__gc) c++ class arguments.
e.g.
c++:
public __gc class Point { ... }
public __gc class Line
{
Line(Point *p0, Point *p1) { ... }
}
c#
namespace MyName
{
...
Point p0 = new Point(1,1);
Point p1 = new Point(2,2);
-> Line line = new Line(p0, p1);
...
I get following compiler error at the marked -> line:
error CS1502 ...
error CS1503 Argument1 can't be converted from MyName.Point to Point
Anybody know, how can I call the 'Line constructor' with 'Point'
arguments?
Thanks in advance
Thomas