When to use FOUNDATION_EXPORT?

后端 未结 2 868
故里飘歌
故里飘歌 2021-02-14 02:31

I am a bit confused as when we should use FOUNDATION_EXPORT in objective-c and what the purpose of that is? Can anyone explain in layman terms? Thanks!

2条回答
  •  [愿得一人]
    2021-02-14 03:23

    When we should use FOUNDATION_EXPORT in Objective-c

    Whenever you are importing foundation framework in Objective-C. It is the best practice to use FOUNDATION_EXPORT instead of extern. Because NSObjCRuntime.h in Foundation framework it includes c and c++ library. So for default visibility of the c and c++ symbols it compiles accordingly for making it more compatible.

    Purpose of using FOUNDATION_EXPORT instead of extern:

    1) Visible Symbolity

    2) Compatibility to other source code.

提交回复
热议问题