environ.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /* Declare the environ system variable.
  2. Copyright (C) 2015-2022 Free Software Foundation, Inc.
  3. This file is part of the libiberty library.
  4. Libiberty is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. Libiberty is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public
  13. License along with libiberty; see the file COPYING.LIB. If not,
  14. write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
  15. Boston, MA 02110-1301, USA. */
  16. /* On OSX, the environ variable can be used directly in the code of an
  17. executable, but cannot be used in the code of a shared library (such as
  18. GCC's liblto_plugin, which links in libiberty code). Instead, the
  19. function _NSGetEnviron can be called to get the address of environ. */
  20. #ifndef HAVE_ENVIRON_DECL
  21. # ifdef __APPLE__
  22. # include <crt_externs.h>
  23. # define environ (*_NSGetEnviron ())
  24. # else
  25. # ifndef environ
  26. extern char **environ;
  27. # endif
  28. # endif
  29. # define HAVE_ENVIRON_DECL
  30. #endif