- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在虚幻引擎 C++ vr 实现中发现了这个宏。有人可以解释这个宏的目标是什么吗?我应该什么时候使用这个宏?为什么我在虚幻引擎源中找不到这个宏?
UCLASS()
class SOMTEMPLATE_VR_API className :
最佳答案
_API 宏用于向其他模块公开类和函数。
来自documentation :
The easiest way to think about these specifiers is that they are used to tag functions, classes or data as public to your module's DLL file. If you mark a function in the Engine module as ENGINE_API, then any module that imports Engine can access that function directly.
These are only used when compiling the engine in modular mode (DLL files on desktop platforms). The opposite is what we call monolithic mode, which puts all code together in a single executable file. The type of build is controlled by UnrealBuildTool settings and/or platforms and build configuration.
The actual API macro equates to one of the following depending on how the code is being compiled by UBT:
__declspec( dllexport )
, when compiling module code in modular mode.
__declspec( dllimport )
, when including public module headers for a module that you are importing.empty, when compiling in monolithic mode
API macros only make sense for modules that are statically imported from another module. The Core module is a great example -- almost every other module in UE4 specifies Core as a import dependency in their *.Build.cs file.
Many modules never need to be statically imported (e.g. SceneOutliner module.) We refer to those modules as dynamically loaded modules. Dynamically loaded modules are awesome because they can be discovered at startup (kind of like a plugin), and often can be reloaded on the fly.
The API macros are mostly used on older code to allow newer modules to access it from their DLL. In newer bits of code, the API macros are used far less, instead setting up nice interface layers to expose functionality across DLL boundaries.
关于c++ - SOMTEMPLATE_VR_API 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56788666/
我在虚幻引擎 C++ vr 实现中发现了这个宏。有人可以解释这个宏的目标是什么吗?我应该什么时候使用这个宏?为什么我在虚幻引擎源中找不到这个宏? UCLASS() class SOMTEMPLATE_
我是一名优秀的程序员,十分优秀!