Environ.hpp

Go to the documentation of this file.
00001 #ifndef BLOCXX_ENVIRON_HPP_INCLUDE_GUARD_
00002 #define BLOCXX_ENVIRON_HPP_INCLUDE_GUARD_
00003 
00004 /*******************************************************************************
00005 * Copyright (C) 2006, Novell, Inc. All rights reserved.
00006 * Copyright (C) 2005, Quest Software, Inc. All rights reserved.
00007 *
00008 * Redistribution and use in source and binary forms, with or without
00009 * modification, are permitted provided that the following conditions are met:
00010 *
00011 *     * Redistributions of source code must retain the above copyright notice,
00012 *       this list of conditions and the following disclaimer.
00013 *     * Redistributions in binary form must reproduce the above copyright
00014 *       notice, this list of conditions and the following disclaimer in the
00015 *       documentation and/or other materials provided with the distribution.
00016 *     * Neither the name of Quest Software, Inc., Novell, Inc., nor the
00017 *       names of its contributors or employees may be used to endorse or promote
00018 *       products derived from this software without specific prior written
00019 *       permission.
00020 *
00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00022 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00023 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00024 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00025 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00026 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00027 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00028 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00029 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00030 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00031 * POSSIBILITY OF SUCH DAMAGE.
00032 *******************************************************************************/
00033 
00039 #include "BLOCXX_config.h"
00040 
00041 #if defined(BLOCXX_DARWIN)
00042 // On MacOSX, environ is not defined in shared libraries.  It is only provided
00043 // for executables.  Since the linker must resolve all symbols at link time,
00044 // the normal extern declaration of environ won't work.  As a substitute, we
00045 // need to use this:
00046 #include <crt_externs.h>
00047 #define environ (*_NSGetEnviron())
00048 
00049 // For more details on the subject, follow one of these links:
00050 // http://lists.gnu.org/archive/html/bug-guile/2004-01/msg00013.html
00051 // http://lists.apple.com/archives/darwin-dev/2005/Mar/msg00132.html
00052 // http://www.metapkg.org/wiki/15 (under the linking problems)
00053 
00054 #else /* !DARWIN */
00055 // according to man environ:
00056 // This variable must be declared in the user program, but is
00057 // declared in the header file unistd.h in case the header files came from
00058 // libc4 or libc5, and in case they came from glibc and _GNU_SOURCE was
00059 // defined.
00060 extern char** environ;
00061 #endif /* DARWIN */
00062 
00063 #endif /* INCLUDE_GUARD */

Generated on Fri Jun 16 15:39:08 2006 for blocxx by  doxygen 1.4.6