﻿
//  copyleft by jinzhongjie(xjinzhongjie@gmail.com).anyone who want change the code please tell writer.
//  Everyone is permitted to copy and distribute verbatim copies
//  of this license document, but changing it is not allowed.
#ifndef _PRESIDENT_
#define _PRESIDENT_
#include "rt_sts.h"
//  表記			製品名 [Visual Studio version] 1		VC++ version 2	_MSC_VER	_MSC_FULL_VER
//  2017 Update 2 3		Visual Studio 2017 version 15.2		14.1		1910		191025017
//  2013 Nobemver CTP	Visual Studio 2013 Nobemver CTP [12.0]	12		1800		180021114
//  2010			Visual Studio 2010 [10.0]		10		1600		160030319
//  2008			Visual Studio 2008 [9.0] 		9		1500		150021022
//  2005			Visual Studio 2005 [8.0] 		8		1400		140050320
//  			Visual C++ 6.0 SP6		
// #if _MSC_VER >=1600
// #if _MSC_VER >=1400
#ifdef LOG_OUTPUT

#ifdef DLL_SLINK
	#define CREATDLL_API
#else
	#ifdef CREATDLL_EXPORTS
		#define CREATDLL_API __declspec(dllexport)
	#else
		#define CREATDLL_API __declspec(dllimport)
	#endif
#endif

#ifdef __cplusplus
extern "C" {
#endif

#if defined(_MSC_VER)
#define   COMLOGF( st, fmt,... )      CLog_Format( st, __FILE__,  __LINE__, __FUNCTION__ ,  fmt, ##__VA_ARGS__ );
#define   COMLOGFW( st, fmt,... )      CLog_FormatW( st, __FILE__,  __LINE__, __FUNCTION__ ,  fmt, ##__VA_ARGS__ );
#else
#define   COMLOGF( st, fmt,... )      CLog_Format( st, __FILE__,  __LINE__, __func__ ,  fmt, ##__VA_ARGS__ );
#define   COMLOGFW( st, fmt,... )      CLog_FormatW( st, __FILE__,  __LINE__, __func__ ,  fmt, ##__VA_ARGS__ );
#endif


const char* getDdeCode(int _nCode);
CREATDLL_API  void CLog_init(void);
CREATDLL_API  void CLog_open(const char* filename);
CREATDLL_API  void CLog_close(void);
CREATDLL_API  void CLog_Format(int _nStatus, const char * _sFile, int _nLine, const char * _sFunc, const char * sFormat, ...);
CREATDLL_API  void CLog_FormatW(int _nStatus, const char * _sFile, int _nLine, const char * _sFunc, const wchar_t * sFormat, ...);



#ifdef __cplusplus
}
#endif
#else
#ifdef __cplusplus
extern "C" {
#endif
#define CREATDLL_API  extern

#define   COMLOGF( st, fmt,... )      ;
#define   COMLOGFW( st, fmt,... )      ;

CREATDLL_API  void CLog_init(void);
CREATDLL_API  void CLog_open(const char* filename);
CREATDLL_API  void CLog_close(void);
#ifdef __cplusplus
}
#endif

#endif

#endif
