Advertisement
Guest User

Mono Test C++

a guest
Sep 13th, 2014
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. MonoClass* monoClass = mono_class_from_name( monoImage, "Test", "TestClass" );
  2. MonoObject* monoObj = mono_object_new( monoDomain, monoClass );
  3. mono_runtime_object_init( monoObj );
  4. int handle = mono_gchandle_new( monoObj, false );
  5.  
  6. MonoMethodDesc* monoMethodSetSomeValueDesc = mono_method_desc_new( "Test.TestClass::__internal_SetSomeValue", true );
  7. MonoMethod* monoMethodSetSomeValue = mono_method_desc_search_in_class( monoMethodSetSomeValueDesc, monoClass );
  8.  
  9. int test = 1234;
  10. void* args[1];
  11. args[0] = &test;
  12.  
  13. MonoObject* exc;
  14. MonoObject* testObj = mono_gchandle_get_target( handle );
  15. std::cout << "Test Obj: " << testObj << std::endl;
  16. mono_runtime_invoke( monoMethodSetSomeValue, mono_gchandle_get_target( handle ), args, &exc );
  17. mono_gchandle_free( handle );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement