SapClassBasicDef.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef _SAPCLASSBASICDEF_H_
  2. #define _SAPCLASSBASICDEF_H_
  3. // SapClassBasicDef.h : header file
  4. //
  5. /////////////////////////////////////////////////////////////////////////////
  6. // Export definitions
  7. #if !defined(POSIX_HOSTPC)
  8. #if defined SAPCLASSBASIC
  9. #define SAPCLASSBASIC_VAR __declspec(dllexport)
  10. #define SAPCLASSBASIC_CLASS __declspec(dllexport)
  11. #else
  12. #define SAPCLASSBASIC_VAR __declspec(dllimport)
  13. #define SAPCLASSBASIC_CLASS __declspec(dllimport)
  14. #endif
  15. #ifdef __clang__
  16. #undef WINAPI
  17. #define WINAPI __stdcall
  18. #endif
  19. #else
  20. // Posix/Linux -> undo Win32'isms
  21. #include <corenv.h>
  22. #include <sys/param.h>
  23. #define SAPCLASSBASIC_VAR
  24. #define SAPCLASSBASIC_CLASS
  25. #ifndef WINAPI
  26. #define WINAPI
  27. #endif
  28. #ifndef __stdcall
  29. #define __stdcall
  30. #endif
  31. #ifndef CALLBACK
  32. #define CALLBACK
  33. #endif
  34. #ifndef MAX_PATH
  35. #define MAX_PATH MAXPATHLEN
  36. #endif
  37. #endif
  38. /////////////////////////////////////////////////////////////////////////////
  39. // New definitions using existing ones in Sapera
  40. #define SAPSTATUS CORSTATUS
  41. /////////////////////////////////////////////////////////////////////////////
  42. // Helper macros for frequently used source code constructs
  43. #define SAP_FREE_POINTER(ptr) \
  44. { \
  45. if (ptr != NULL) \
  46. { \
  47. delete ptr; \
  48. ptr = NULL; \
  49. } \
  50. }
  51. #define SAP_FREE_ARRAY(array) \
  52. { \
  53. if (array != NULL) \
  54. { \
  55. delete [] array; \
  56. array = NULL; \
  57. } \
  58. }
  59. #endif // _SAPCLASSBASICDEF_H_