I apologize if this is a duplicate. I am writing a class that needs to interact with an old c++ unmanaged dll. There is one method that I am having a hard time mapping to managed code:
long DoSomething(int id, double* points, long numberOfPoints, bool useShaping)
I have been thus far unable to map that to an extern method that does not throw a stack unbalanced exception. The problem is with the double pointer. What would the method signature look for in managed code? Here’s what I’ve tried that does not work as an example.
[DllImport("Something.Dll", EntryPoint = "DoSomething")]
public static extern long DoSomething(int id, double[] points, long numberOfPoints, bool useShaping)
There are likely two problems –
Try the following: