[Mono-dev] mono_add_internal_call to mscorlib method

nicob nicolasbotto at gmail.com
Wed Jun 8 19:26:38 UTC 2016


Hi, I'm trying to use the Skype Sdk in mono embedded. I'm able to load the
assemblies but when I try to create a instance of a class that internally
calls System.Environment.GetCommandLineArgs it throws an exception. After
digging a bit I found out the System.Environment.GetCommandLineArgs
internally invokes:

private static extern string[] GetCommandLineArgsNative();

this method is returning null therefore it fails. I'm trying to add an
internal call to the extern method using:

mono_add_internal_call ("System.Environment::GetCommandLineArgsNative",
(void*)GetCommandLine);

I also tried:

mono_add_internal_call
("mscorlib.System.Environment::GetCommandLineArgsNative",
(void*)GetCommandLine);

but neither of them seem to work as my C++ function is never invoked.

C++ function:
MonoArray* GetCommandLine()
{
    MonoDomain* domain = mono_domain_get();
    MonoArray* array = mono_array_new(domain, mono_get_string_class(), 1);
    
    MonoString* ret = mono_string_new(domain, "yeah!");
    mono_array_setref(array, 0, ret);
    
    return array;
}


Am I missing something?

Thanks in advanced.



--
View this message in context: http://mono.1490590.n4.nabble.com/mono-add-internal-call-to-mscorlib-method-tp4667951.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list