0

A function in dll is defined like this:

int DLLDIR nvcp_ep_to_buf(int ep_id, unsigned char** o_buf);

I want to call this function using dllimport, how could I declare this function in c#, and how can I call this function? If I call this function in c++, I allocate memory for o_buf and then call this function, it works.

Ben
  • 2,433
  • 5
  • 39
  • 69
L.Doe
  • 49
  • 3
  • Too little informations... what should this `o_buf` be? A two dimensional array of `unsigned char`? Because often when you see a `char**` as a parameter, it means that the memory is allocated by the called function, and not by the calling function. – xanatos Aug 03 '15 at 06:57
  • 1
    `unsigned char**` does not define the interface sufficiently. `unsigned char**` could be many different things. Please consult the documentation. It will provide the missing details. – David Heffernan Aug 03 '15 at 07:46
  • Sorry for the delay. I struggled 2 days because of this problem but still can not solve it, I'd like to provide more details here: o_buf is a pointer to an array of char. I want to know if i can use Intptr to bring the o_buf back, and I set the value of o_buf to a char *p; and then I can traverse p by the index. But I don't know how can I get the value of Intptr which is a pointer to something in the memory. Anyone can give me some specific code to solve this? – L.Doe Aug 11 '15 at 02:06

0 Answers0