This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: __cygwin_environ, __imp_environ, _cur_environ, where is 'environ' symbol?


On Jun 11 23:55, Vasyl Khalak wrote:
> I have tried to compile 0.18.2 gettext on x64 Cygwin, and got
> "undefined reference to `environ'", where is the symbol?
> 
> user@host /cygdrive/c/cygwin
> 
> 32 bit:
> $ nm lib/libcygwin.a
> 00000000 I __imp____cygwin_environ
> 00000000 I __nm____cygwin_environ
> ...
> 00000000 B _environ
> 
> $ nm bin/cygwin1.dll
> 61227a44 B ___cygwin_environ
> 6102db00 T _cur_environ@0
> 61184444 D _main_environ
> 
> 64 bit:
> $ nm /usr/lib/libcygwin.a
> 0000000000000000 I __imp_environ
> 0000000000000000 I __nm_environ
> 
> $ nm /usr/bin/cygwin1.dll
> 00000001802a4778 B __cygwin_environ

environ is the exported symbol referencing the internal __cygwin_environ
variable on x86_64.  Linking against and accessing it works for me:

  $ uname -a
  CYGWIN_NT-6.2 VMBERT864 1.7.21(0.266/5/3) 2013-06-11 21:43 x86_64 Cygwin
  $ cat > envtest.c <<EOF
  #include <stdio.h>

  int
  main ()
  {
    extern char **environ;

    printf ("environ: %p first entry: <%s>\n", &environ, environ[0]);
    return 0;
  }
  EOF
  $ gcc -o envtest envtest.c
  $ ./envtest
  environ: 0x1802a4778 first entry: <ALLUSERSPROFILE=C:\ProgramData>


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]