c# wrapper for a c DLL
Posted
by Without me Its just Aweso
on Stack Overflow
See other posts from Stack Overflow
or by Without me Its just Aweso
Published on 2010-06-02T13:02:15Z
Indexed on
2010/06/02
13:03 UTC
Read the original article
Hit count: 299
I'm attempting to write a wrapper so that my C# application can use a DLL written in C. Here is a method defintion that i'm trying to wrap:
void methodA(const uint32_t *data); //c header declaration
The issue I'm having is trying to figure out how to give a equivalent pointer from c#. In c# I want it to operate on a:
UInt32 data[] //my c# object i want to be able to pass in
but how do I give an equivalent pointer in my wrapper? I have tried
ref data //my attempt at giving an equivalent pointer to the DLL
but that doesnt seem to be working. Using debug statements in the DLL I can see that the values it gets that way are not what I'm attempting to pass in.
So my question boils down to have do I properly wrap a c fuction that is using a pointer to reference an array?
© Stack Overflow or respective owner