[Mono-dev] mono_add_internal_call to mscorlib method
Robert Jordan
robertj at gmx.net
Thu Jun 9 08:51:01 UTC 2016
On 08.06.2016 21:26, nicob wrote:
> 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.
You can't override methods which have an IL implementation with icalls.
However, your problem is most likely related to the fact that
you haven't initialized the runtime properly.
You're supposed to invoke a "static void Main () {} " method (which
you can implement in a support assembly) with mono_jit_exec ().
Robert
More information about the Mono-devel-list
mailing list