You're looking at the wrong implementation of Environment.cs. The one we're using is still Mono's implementation (as opposed to the MS referencesource one you're looking at): https://github.com/mono/mono/blob/37bb54b503f3f8c948955c577687d4233e950cb5/mcs/class/corlib/System/Environment.cs#L472
It ends up calling into the runtime to https://github.com/mono/mono/blob/37bb54b503f3f8c948955c577687d4233e950cb5/mono/metadata/icall.c#L6942-L6949 . Anyway, this shouldn't matter as you're not supposed to add an icall for that yourself, it's provided by Mono. From a quick reading of the code there's no way this can return null so I'm a bit confused, but I'll let the runtime experts weigh in :) - Alex 2016-06-08 21:26 GMT+02:00 nicob <nicolasbo...@gmail.com>: > 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. > _______________________________________________ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list >
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list