I'm new to C# - I'm from the C school of coding. I am writing a front end in C# that connects via a DLL to some CUDA GPU code. I need to pass an array of structs to the DLL. I first need to figure out how to create a pointer to the array of structs.

For example, I have a simple struct

public struct cNum
{
   public int x,y;
}

Inside my main func, I have:

cNum[] c = new cNum[10];

How would I create a pointer to the array above that I could then send to my DLL? I know about the unsafe{} requirement, and I've successfully used pointers to pass and modify data in my DLL.

Any help would be greatly appreciated!

Check out this thread on MSDN.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.