Muzzy... for the C# dll method:
namespace ClassLibrary1
{
public class Class1
{
public int TestArgs(params int[] args) {
return args.Length;
}
}
}
You can do in MC++2.0
int CallVarArgs() {
array<int,1>^ ai= gcnew array<int,1>(3){1,2,3};
ClassLibrary1::Class1^ c= gcnew ClassLibrary1::Class1;
return c->TestArgs(ai);
}
Have fun,
JAL
JAL,
> Muzzy... for the C# dll method:
>
[quoted text clipped - 15 lines]
> return c->TestArgs(ai);
> }
Actually, C++/CLI (it's not called MC++ 2.0, btw <g>) fully supports managed
vararg methods, so you can just call it:
Test^ t = gcnew Test();
Console::WriteLine(t->SumUp(1,2,3,4,5,6,6));
The original MC++, however, doesn't support them, so there you *do* have to
create an array to call it:
Int32 params __gc[] = { 9,1,3 };
t->SumUp(params);
MuZZy - 18 Nov 2005 14:41 GMT
> JAL,
>
[quoted text clipped - 22 lines]
> Test^ t = gcnew Test();
> Console::WriteLine(t->SumUp(1,2,3,4,5,6,6));
I'm a bit confised - is it (above) supported in .NET 1.1 or only from .NET 2.0?
> The original MC++, however, doesn't support them, so there you *do* have to
> create an array to call it:
>
> Int32 params __gc[] = { 9,1,3 };
> t->SumUp(params);
Carl Daniel [VC++ MVP] - 18 Nov 2005 18:00 GMT
>> Actually, C++/CLI (it's not called MC++ 2.0, btw <g>) fully supports
>> managed vararg methods, so you can just call it:
[quoted text clipped - 3 lines]
> I'm a bit confised - is it (above) supported in .NET 1.1 or only from .NET
> 2.0?
Only VC++ 2005/.NET 2.0.
-cd
JAL - 18 Nov 2005 22:23 GMT
You are right, of course. I swear I tried it and I got a compiler error, but
of course now it compiles just fine :).
Personally I like MC++2.0 over C++/CLI. I find it descriptive and useful. It
implies managed over unmanaged C++ and it implies targeting the NET 2.0
framework as opposed to 1.0 or 1.1.
> Actually, C++/CLI (it's not called MC++ 2.0, btw <g>) fully supports managed
> vararg methods, so you can just call it: