How do I return an array of doubles from a managed .NET C# object to unmanaged c++ COM code?
If in C# i define a class as: (and tell visual studio to make the assembly COM visible)
public interface _myinterface
{
public double[] getDoubles()
}
public class myinterface: _myinterface
{
public double[] getDoubles()
{
double[] doubles;
doubles = new double[10];
return doubles;
}
}
I'm ending up with a type library declaration of:
SAFEARRAY(double) getDoubles();
and when i create a C++ class in visual studio 2008 based on the type library i get:
SAFEARRAY * getDoubles()
{
InvokeHelper(0x6002000a, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
which doesn't even compile because it is not returning a value.
Does what i'm attempting here make sense and/or is there a different way to do this that will yield better results?
Thanks,
Barry