hung tran

hung tran

  • NA
  • 1
  • 3.2k

how to convert void* from C++ to C#

Dec 28 2010 1:33 AM
I use .dll generated by C++ in C#. here is property:
QLIB (void *a, void *b)
a point to structure1 (input)
b point to structure2 (output)

structure1 contains"int, short, double.."
structure2 contains "byte" only
I do like this:
        [DllImport(DirPath, EntryPoint = "QLIB")]
unsafe public extern static sbyte QLIB(void* a, IntPtr  b);

structure1 st1;
IntPtr st2;
QLIB ( (void*) &st1, st2);
but the result seem to be the function cannot read data from structure1. Please help me. Thanks a lot.