aboutsummaryrefslogtreecommitdiff
path: root/libxsde/xsde/cxx/errno.ixx
blob: 63c5a8c309891ef919d78d436ae929f71d589c07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// file      : xsde/cxx/errno.ixx
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

#include <xsde/cxx/config.hxx>

#ifdef XSDE_PLATFORM_WINCE
#  include <winbase.h> // Get/SetLastError
#else
#  include <errno.h>
#endif

namespace xsde
{
  namespace cxx
  {
#ifdef XSDE_PLATFORM_WINCE
    inline int
    get_errno ()
    {
      return static_cast<int> (GetLastError ());
    }

    inline void
    set_errno (int e)
    {
      SetLastError (static_cast<DWORD> (e));
    }
#else
    inline int
    get_errno ()
    {
      return errno;
    }

    inline void
    set_errno (int e)
    {
      errno = e;
    }
#endif
  }
}