[Mono-dev] Embedding Mono - NULL return value in C#

marcus julius marcusjls at yahoo.com
Wed Dec 15 03:51:00 EST 2010


Hi,

I call a c++ function from C# using mono.
For instance,

[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern internal static Object get_ai_behavior_object(int id);

When the function returns a NULL object, there is a NullReferenceException. I think it occurs because C# tries to cast null to System.Object. 

Is there a way to avoid this without using try-catch which slows the program or a dummy Null object I need to create?

Thanks,

Mesut,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20101215/2e5bbb8d/attachment-0001.html 


More information about the Mono-devel-list mailing list