Last active
December 14, 2015 15:09
-
-
Save chenzx/5105971 to your computer and use it in GitHub Desktop.
Useful C/C++ macros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef _DEBUG | |
#ifdef _WIN32 | |
#define dprintf(format,...) fprintf(stdout, "%s:%d:%s " format , __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) | |
#else | |
//gcc: | |
#define dprintf(format, args...) fprintf(stdout, "%s:%d:%s " format, __FILE__, __LINE__, __FUNCTION__, ## args) | |
#endif | |
#else | |
#define dprintf(format, args...) | |
#endif | |
#if defined(BUILD_DLL) | |
#if defined WIN32 | |
#define XYZ_API __declspec(dllexport) | |
#else //GCC | |
#define XYZ_API __attribute__ ((visibility ("default"))) | |
#endif | |
#else | |
#if defined _WIN32 | |
#define XYZ_API __declspec(dllimport) | |
#else //GCC | |
#define XYZ_API | |
#endif | |
#endif | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment