Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: environ symbol undefined?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: environ symbol undefined?

On Mar 25, 2005, at 9:01 PM, Michael B Allen wrote:

I reference the symbol environ(7) but the linker is choking on it:

  ld: for architecture ppc
  ld: Undefined symbols:
  libtool: internal link edit command failed

What doesn't libc export that symbol? What am I doing wrong?

Are you building a shared library? If so, that symbol gets filled in at process startup time, so it is only defined in executables. You need to do something like:

#include <crt_externs.h>
#define environ (*_NSGetEnviron())

Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

 >environ symbol undefined? (From: Michael B Allen <email@hidden>)

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.