Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Unity like internal call with mono

Tags:

mono

unity3d

C# side code

[WrapperlessIcall]

[MethodImpl(MethodImplOptions.InternalCall)]

private extern void INTERNAL_set_rotation(ref Quaternion value);

How to expose this method from C++ to mono

Thanks.

like image 660
adamgamer Avatar asked Feb 20 '23 06:02

adamgamer


1 Answers

You need to call mono_add_internal_call:

mono_add_internal_call ("YourClass::INTERNAL_set_rotation", yourclass_INTERNAL_set_rotation);

There is some documentation here: http://www.mono-project.com/Embedding_Mono#Exposing_C_code_to_the_CIL_universe

And here is a code sample: https://github.com/mono/moon/blob/8d8ece884382d653d215b0da5bf633079566d816/src/deployment.cpp#L579

like image 130
Rolf Bjarne Kvinge Avatar answered Mar 09 '23 07:03

Rolf Bjarne Kvinge