相关文章推荐
任性的紫菜汤  ·  Fragment的setUserVisibl ...·  7 月前    · 
安静的硬币  ·  Vue ...·  1 年前    · 
高大的荔枝  ·  QGraphicsScene管理QGraph ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am working with unity for an iOS game. For unlocking achievement I need to access a "Achievement.mm" file from my c# code:

    [DllImport("__Internal")]
    private static extern void
       GKAchievement(string achievementID, float progress, bool value);

I got this code from a forum. But, what does the "__Internal" means ?

It is specific to Mono, tells it to look for the function in your own program instead of another DLL. I think also required to get your app certified by Apple. Explained pretty well in the docs. – Hans Passant Jul 26, 2016 at 11:56
  • Plugins link their code to C# unity using [DllImport()].
  • __internal is a keyword used for static linking needed by specific platforms, such as XBox and iOS.
  • Other platforms usually use dynamic linking, hence this is not needed.
  • Please for more info refer to: https://docs.unity3d.com/Manual/NativePlugins.html

    Just the minor tip.

    If the library being loaded is __Internal, then the main program is searched for method symbols. This happens to be the case on iOS platform.

    The plugins on iOS cannot load dynamically. Only statically as @RaxelZ explained.

    It is different for OSX, Windows, Android ... those platforms may load plugins dynamically. For iOS, only statically.

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.