Marshalling double[3] in C#

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.
 
M

Mattias Sjögren

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top