On 09.06.2016 15:37, nicob wrote:
Hi Robert, thanks for the reply. I didn't explain my self correctly. Here's
an example, I have a c# assembly with a method that prints the args to the
console:

I believe I didn't explain the workaround entirely.

Parts of the Mono runtime are expecting that the main entry point
of some assembly has been executed.

Environment.GetCommandLineArgs belongs clearly to this part of
the runtime because, well, it needs data only provided
by executing the main entry point.

The trick is to invoke  mono_jit_exec () on a simple assembly
which does only this:

$ cat <<EOF > entrypoint.cs
namespace Helper {
   public static class EntryPoint {
        public static void Main ()
        {
        }
   }
}
EOF

$ mcs /target:exe /out:entrypoint.dll entrypoint.cs


Then load entrypoint.dll and pass it to mono_jit_exec.
After this call, almost all parts of the runtime will work
as expected, including Environment.GetCommandLineArgs.
It will return what you've provided to mono_jit_exec ().

Robert


_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to