建立dll项目后,在头文件中,定义API宏 #ifndef API_S_H #define API_S_H ...... #ifndef DLL_S_20160424 #define API _declspec(dllimport) #else #define API _declspec(dllexport) #endif ...... int API apiFunction(); #endif 在头文件导出函数前添加 API 类型说明 int API apiFunction(); 关键的是.c
linux内核中offsetof与container_of的宏定义 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) /** * container_of - cast a member of a structure out to the containing structure * @ptr: the pointer to the member. * @type: the type