Pass array of struct to C# from C DLL

Kira Yamato 1 Reputation point
2022-11-02T12:21:31.597+00:00

Hi~

I have some codes in C and I try to create a DLL for another C# program to invoke

In my C codes I have a global array of self-defined struct which hold some data and properties, which may goes like:

struct Data {  
double t;  
double states[6]  
......  
}  
struct Data dt[20];  

I wonder how to get this pointer to the array of struct ( struct Data dt[20];) in C# so that the C# codes can manipulate the array of struct both by invoke the C functions and call new C# functions

Thank you

Developer technologies C#
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2022-11-02T15:03:13.29+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.