// 下列 ifdef 块是创建使从 DLL 导出更简单的 // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 CREATE_DUMP_EXPORTS // 符号编译的。在使用此 DLL 的 // 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将 // CREATE_DUMP_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的 // 符号视为是被导出的。 #ifndef __linux__ #ifdef CREATE_DUMP_EXPORTS #define CREATE_DUMP_API __declspec(dllexport) #else #define CREATE_DUMP_API __declspec(dllimport) #endif #else #define CREATE_DUMP_API __attribute__ ((visibility("default"))) #endif // 此类是从 create_dump.dll 导出的 //class CREATE_DUMP_API Ccreate_dump { //public: // Ccreate_dump(void); // // TODO: 在此添加您的方法。 //}; // //extern CREATE_DUMP_API int ncreate_dump; // //CREATE_DUMP_API int fncreate_dump(void); #pragma once #pragma message("Using include dir's ExceptionReport") #ifndef RSExecptionTString #include typedef std::basic_string RSExecptionTString; #endif class CREATE_DUMP_API CExceptionReport { public: CExceptionReport(); ~CExceptionReport(); static LONG WINAPI UnhandledExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo); private: static const RSExecptionTString FormatCurrentTimeString(); static bool writeMiniDump(PEXCEPTION_POINTERS pExceptionInfo); static void SuspendThreads(); static LPTOP_LEVEL_EXCEPTION_FILTER m_previousExceptionFilter; static TCHAR m_pDmpFileName[MAX_PATH]; static HANDLE m_hDumpFile; static void InvalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, unsigned int line, uintptr_t pReserved); static BOOL m_bFirstRun; static _invalid_parameter_handler s_fnInvalidParameterHandler; }; extern CExceptionReport ExceptionReport; //global instance of class