Thanks for your reply, but it doesn't work, I got this message, "Unhandled
Exception: System.InvalidCastException: Cannot cast from source type to
destination type."
I want to know the different definition of these 2 C functions in C#, int
MyFunc(int param1, MyStruct** param2); and int MyFunc(int param1, MyStruct*
param2);, what is the different declaration in C#?
Regards,
ZhangZQ
"Fabian Schmied" <REMOVETHISfabianDOTschmied@fhs-hagenbergDOTacDOTat> ????
news

(E-Mail Removed)...
> > if there is a C function in a DLL(My.dll) has this declaration,
> >
> > struct MyStruct
> > {
> > int a;
> > int b;
> > };
> >
> > int MyFunc(int param1, MyStruct** param2);
> >
> >
> > how to define this in C# ?
>
> In C#, don't define MyStruct as a struct, define it as a class. This will
> add an additional layer of indirection. Then,
>
> [DllImport("My.dll")]
> static extern int MyFunc(int param1, ref MyStruct param2);
>
> should work, I think.
>
> (If this is really a C function, you might need to use
> CallingConvention.Cdecl the default is StdCall.)
>
> Fabian