Advertisement

09.13.2007 at 11:17AM PDT, ID: 22827028
[x]
Attachment Details

Converting array of pointers in C struct to C#

Asked by Barbless in Microsoft Visual C#.Net, C# Programming Language

Tags: array, struct, pointer, c

I need to convert the following C struct that contains an array of pointers to C#:

typedef struct {
    float* a[5];
} MyStruct;

I tried the following and the line that reads "public float[] *a;" below doesn't pass the compiler

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
unsafe public struct MyStruct
{
   [MarshallAs (UnmanagedType.ByValArray, SizeConst = 5)]
    public float[] *a;
}

Any suggestions?Start Free Trial
 
 
Loading Advertisement...
 
[+][-]09.13.2007 at 11:35AM PDT, ID: 19885989

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.13.2007 at 11:44AM PDT, ID: 19886083

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.13.2007 at 11:52AM PDT, ID: 19886157

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.13.2007 at 12:23PM PDT, ID: 19886400

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual C#.Net, C# Programming Language
Tags: array, struct, pointer, c
Sign Up Now!
Solution Provided By: jasonclarke
Participating Experts: 3
Solution Grade: A
 
 
[+][-]09.13.2007 at 12:41PM PDT, ID: 19886527

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.13.2007 at 12:44PM PDT, ID: 19886548

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.14.2007 at 06:14AM PDT, ID: 19891095

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628