• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Where does _environ come from?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where does _environ come from?


  • Subject: Re: Where does _environ come from?
  • From: Eric Albert <email@hidden>
  • Date: Sat, 10 Jan 2004 14:53:42 -0800

At 12:03 PM -0800 1/7/04, Kevin Hoyt wrote:
I have several projects in Xcode, one of which builds a framework.  The
link step for the framework project fails because '_environ' is not
defined.  This is not an issue for my other command line tools, which use
the same code base.  I've compared the projects and they appear to be
linking against the same set of system frameworks.

Any suggestions on why the framework project can't find _environ when the
command line tool projects do?

_environ is defined in /usr/lib/crt1.o, which is only linked into executables. The corresponding file for dylibs (which frameworks use) is /usr/lib/dylib1.o and doesn't define _environ. Annoying as that is, it's correct because otherwise your library's _environ would be different from the _environ of the executable that loaded it.


If you want to use _environ in a library on Mac OS X, you should use *_NSGetEnviron() instead. It's defined in /usr/include/crt_externs.h.

Hope this helps,
Eric
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: CVS ignore...
  • Next by Date: syntax coloring for methods
  • Previous by thread: Where does _environ come from?
  • Next by thread: Getting inputs and outputs for a shell script phase?
  • Index(es):
    • Date
    • Thread