Marshalling double[3] in C#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'd have a DLL that exposes the function below.

CS_cs3ll (struct cs_Csprm_ *csprm, double ll [3], double xy [3]);

I would like to use DllImport in C# to call this function.

The issue I have concerns the last argument because it is considered an out
by the function.

How can I indicate that the fixed array of 3 double should by marshalled by
reference and that the values must be marshalled back to the client.

With VS2003 we ended up doing a Managed C++ dll but I was wondering if
VS2005 (C# 2.0) can support this.
 
How can I indicate that the fixed array of 3 double should by marshalled by
reference and that the values must be marshalled back to the client.

With VS2003 we ended up doing a Managed C++ dll but I was wondering if
VS2005 (C# 2.0) can support this.

Did you try simply declaring it as a double[]? Should work in all
versions of C#. You may have to add the [Out] attribute.


Mattias
 
I did, the function call does not return an error but I don't have the values
in the array.

Mattias Sjögren said:
How can I indicate that the fixed array of 3 double should by marshalled by
reference and that the values must be marshalled back to the client.

With VS2003 we ended up doing a Managed C++ dll but I was wondering if
VS2005 (C# 2.0) can support this.

Did you try simply declaring it as a double[]? Should work in all
versions of C#. You may have to add the [Out] attribute.


Mattias
 
Back
Top