fullpowers
V2EX  ›  C

int HID_API_EXPORT hid_init(void); 中 HID_API_EXPORT 的作用是什么?

  •  1
     
  •   fullpowers · Jun 8, 2018 · 3046 views
    This topic created in 2893 days ago, the information mentioned may be changed or developed.
    4 replies    2018-06-08 17:39:36 +08:00
    ziv763
        1
    ziv763  
       Jun 8, 2018   ❤️ 1
    __declspec(dllexport)
    alqaz
        2
    alqaz  
       Jun 8, 2018   ❤️ 1
    跨平台模块的编写方法,用于导出模块的函数。windows 下是一楼的,其他可能只有一句 #define HID_API_EXPORT
    hustfox
        3
    hustfox  
       Jun 8, 2018   ❤️ 2
    #ifdef LOG_EXPORTS
    #define LOG_API __declspec(dllexport)
    #else
    #define LOG_API __declspec(dllimport)
    #endif
    LOG_API void tracelog(const char* pszFileID, int level,char *str,...);

    一般情况下定义一个宏 LOG_EXPORTS 用于判别该 DLL 是导出还是导入的,在引用该 DLL 的工程里是没有 LOG_EXPORTS 宏的,那么 LOG_API 就是:__declspec(dllimport),而在该 DLL 工程中需要在预定义宏中添加 LOG_EXPORTS,这样 LOG_API 就是:__declspec(dllexport)
    afpro
        4
    afpro  
       Jun 8, 2018
    __attribute__((visibility("default")))
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1180 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 17:42 · PVG 01:42 · LAX 10:42 · JFK 13:42
    ♥ Do have faith in what you're doing.