You need to check the definitions for the different types between C# and C++. For example,
UnmanagedType.LPStr
as defined
here[
^], is a pointer to a null-terminated array of ANSI characters. This equates to a
char*
in C++, not a
string
.
Similarly, you are returning an
unsigned long (hh.to_ulong())
to a C# call that expects a
Double
value to be returned.