YARP  2.3.70.2
Yet Another Robot Platform
PlatformStdlib.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 iCub Facility, Istituto Italiano di Tecnologia (IIT)
3  * CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
4  */
5 
6 #ifndef YARP_OS_IMPL_PLATFORMSTDLIB_H
7 #define YARP_OS_IMPL_PLATFORMSTDLIB_H
8 
9 #include <yarp/conf/system.h>
10 #ifdef YARP_HAS_ACE
11 # include <ace/OS_NS_stdlib.h>
12 #else
13 # include <stdlib.h>
14 #endif
15 
16 namespace yarp {
17 namespace os {
18 namespace impl {
19 
20 
21 #if defined(YARP_HAS_ACE)
22  using std::getenv;
23 # if defined(_MSC_VER)
24  // ACE bindings for setenv and unsetenv do not work
25  // on Visual Studio (last tested ACE 6.4.2, VS 2015).
26  inline int setenv(const char *name, const char *value, int overwrite) {
27  YARP_UNUSED(overwrite);
28  return _putenv_s(name, value);
29  }
30  inline int unsetenv(const char *name) {
31  return _putenv_s(name, "");
32  }
33 # else
34  using ACE_OS::setenv;
35  using ACE_OS::unsetenv;
36 # endif
37  using ACE_OS::putenv;
38 #else
39  using std::getenv;
40  using ::setenv;
41  using ::unsetenv;
42  using ::putenv;
43 #endif
44 
45 
46 } // namespace impl
47 } // namespace os
48 } // namespace yarp
49 
50 
51 #endif // YARP_OS_IMPL_PLATFORMSTDLIB_H
The main, catch-all namespace for YARP.
const char * getenv(const char *var)
Portable wrapper for the getenv() function.
Definition: Os.cpp:60
ConstString name
Definition: Module.h:221