c# marshaling floating pointer
I have to call a c++ function from c# app. The function is defined as Bool GetTemperaure(float *value)
. I have defined as below.
[DllImport("xxx.dll")]
public static extern bool GetTemperaure(out System.Single v开发者_StackOverflow社区alue);
When i call GetTemperaure, sometimes i am not getting the proper value. I have just put an expection block around this call. Divided by zero exception appears some time.
What ever i have defined is that correct? any ideas why the exception is coming?
Thanks Raju
The question says "Bool" did you mean bool or BOOL? They have different meanings in C++. Thus you might have the incorrect prototype. You might need UnmanagedType.Bool or System.Boolean depending on the C++ side.
精彩评论