Search Unity

How to call RuntimeEnvironment in il2cpp?

Discussion in 'Editor & General Support' started by junestone, Jul 28, 2019.

  1. junestone

    junestone

    Joined:
    May 30, 2017
    Posts:
    42
    Code (CSharp):
    1. string rtdir = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory();
    ArgumentException: Invalid path
    at System.IO.Path.GetDirectoryName (System.String path) [0x00000] in <00000000000000000000000000000000>:0

    why il2cpp has runtime directory?
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    I don't believe that IL2CPP currently supports this API. It might be something that we can add support for (at least on some platforms), but I'm curious about why your application needs to know the directory where the .NET runtime is installed.
     
  3. junestone

    junestone

    Joined:
    May 30, 2017
    Posts:
    42
    Hi, we're integrating Python into Unity. And it requires a lot hack on il2cpp(Mono now is 100% working!).
    The reason why we wanna do this, is that server side's code is developed with Bigworld and we wanna both side share the same code base.
    And some one say with Mono.Cecil, manually injecting IL code to delegate can bypass that API, it there anyway to do it? Curious...
     
  4. junestone

    junestone

    Joined:
    May 30, 2017
    Posts:
    42
    https://forum.unity.com/threads/help-with-aot-compilation-with-monopinvokecallback.717917/ I'm sorry, this is the post I'm talking about. And this API we don't need it now, Pypassed^^
     
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    I don't think there is any need to inject IL code to handle either of these cases. I've responded on the other forum thread about the MonoPInvokeCallback issue.

    For the GetRuntimeDirectory method, you can submit a bug report, and we will investigate the complexity of implementing it.
     
  6. junestone

    junestone

    Joined:
    May 30, 2017
    Posts:
    42
    Ok, i'll do it later. But plz help us with MonoPInvokeCallback, any detailed information would be appreciated, because we can't implement it like the normal case.

    I can send the complete sample code for testing.
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936