什么是 DLL_SYMBOL?
What is a DLL_SYMBOL?
我在 Ubuntu 14.04 运行,我在头文件中找到了 DLL_SYMBOLs 语句:
DLL_SYMBOL void mmi_print_info(mmi_info_t *m);
DLL_SYMBOL int mmi_get_menu_text(int sockfd, char *buf, int buf_len, int timeout);
DLL_SYMBOL int mmi_send_menu_answer(int sockfd, char *buf, int buf_len);
DLL_SYMBOL UDPContext *mmi_broadcast_client_init(int port, char *iface);
DLL_SYMBOL void mmi_broadcast_client_exit(UDPContext *s);
DLL_SYMBOL int mmi_poll_for_menu_text(UDPContext *s, mmi_info_t *m, int timeout);
DLL_SYMBOL int mmi_open_menu_session(char *uuid, char *iface,int port, int cmd);
DLL_SYMBOL void mmi_close_menu_session(int s);
DLL_SYMBOL int mmi_cam_reset(char *uuid, char *intf, int port, int slot);
DLL_SYMBOL int mmi_cam_reinit(char *uuid, char *intf, int port, int slot);
这是特殊声明吗?
这是一个宏。许多库在 public .h
文件中有一个宏来指定它们的 public 函数的调用约定,客户端 coude 将包含该文件以使用该库。
你的可能是一个 Windows 图书馆。在 Windows 中,要从 DLL 使用的任何函数都应使用 __declspec(dllimport)
声明,以便生成调用 DLL 的正确代码。所以这可能就是您的宏扩展到的内容。如果您查看库的头文件,您会发现类似以下内容:
#define DLL_SYMBOL __declspec(dllimport)
一个有趣的相关问题是,当您在 Windows 中编译 DLL 时,public 函数应使用 __declspec(dllexport)
声明。所以大多数库使用相同的头文件来导入和导出 public 函数,并用类似的东西定义宏:
#ifdef COMPILING_MY_LIBRARY
#define DLL_SYMBOL __declspec(dllexport)
#else
#define DLL_SYMBOL __declspec(dllimport)
#endif
然后,在编译库时,他们定义了宏COMPILING_MY_LIBRARY
。
我在 Ubuntu 14.04 运行,我在头文件中找到了 DLL_SYMBOLs 语句:
DLL_SYMBOL void mmi_print_info(mmi_info_t *m);
DLL_SYMBOL int mmi_get_menu_text(int sockfd, char *buf, int buf_len, int timeout);
DLL_SYMBOL int mmi_send_menu_answer(int sockfd, char *buf, int buf_len);
DLL_SYMBOL UDPContext *mmi_broadcast_client_init(int port, char *iface);
DLL_SYMBOL void mmi_broadcast_client_exit(UDPContext *s);
DLL_SYMBOL int mmi_poll_for_menu_text(UDPContext *s, mmi_info_t *m, int timeout);
DLL_SYMBOL int mmi_open_menu_session(char *uuid, char *iface,int port, int cmd);
DLL_SYMBOL void mmi_close_menu_session(int s);
DLL_SYMBOL int mmi_cam_reset(char *uuid, char *intf, int port, int slot);
DLL_SYMBOL int mmi_cam_reinit(char *uuid, char *intf, int port, int slot);
这是特殊声明吗?
这是一个宏。许多库在 public .h
文件中有一个宏来指定它们的 public 函数的调用约定,客户端 coude 将包含该文件以使用该库。
你的可能是一个 Windows 图书馆。在 Windows 中,要从 DLL 使用的任何函数都应使用 __declspec(dllimport)
声明,以便生成调用 DLL 的正确代码。所以这可能就是您的宏扩展到的内容。如果您查看库的头文件,您会发现类似以下内容:
#define DLL_SYMBOL __declspec(dllimport)
一个有趣的相关问题是,当您在 Windows 中编译 DLL 时,public 函数应使用 __declspec(dllexport)
声明。所以大多数库使用相同的头文件来导入和导出 public 函数,并用类似的东西定义宏:
#ifdef COMPILING_MY_LIBRARY
#define DLL_SYMBOL __declspec(dllexport)
#else
#define DLL_SYMBOL __declspec(dllimport)
#endif
然后,在编译库时,他们定义了宏COMPILING_MY_LIBRARY
。