Subject: AW: problems with --export-all-symbols option
From: "Ralf Habacker" <[email-masked]>
To: "PaulSokolovsky" <[email-masked]>
Cc: "Cygwin" <[email-masked]>, "Cygwin" <[email-masked]>
Date: Fri, 20 Apr 2001 08:28:08 +0200

Hi Paul,

I've have problems with generating dll's on porting KDE on CYGWIN. One
solution is published by the dllhelpers tool with __declspec(dllexport)
directive.
But for KDE and other big applications this means, that I have to patch
(!)all headers and to integrate this in the main delevopment process, which
is very difficult. So I was looking for another way and have mentioned that
this was in --export-all-symbols. Can you help me ?

Thanks

Ralf Habacker
EMail: [email-masked]
       [email-masked]

See this thread:
>   http://cygwin.com/ml/cygwin/2000-11/msg00242.html
>
> and perhaps contact Paul directly -- he may have pushed his changes into
> binutils by now, but I don't know.
>
> --Chuck
>
>
> Ralf Habacker wrote:
> >
> > Hi,
> >
> > I like to use the --export-all-symbols option to create a dll with all
> > symbols exported how I found in the online documentation of gcc
> > But this results in a linker failure, which says that some symbols
> > "_[bss|data]_[start|end]__" not found.
> > Additional in the resulting .a file the global variable is left.
> >
> > By the way I'm using gcc version 2.95.3-2 (cygwin special).
> >
> > I have added an example for this problem.
> >
> > foo.h -----------------
> >
> > extern int testvar;
> > int testfunc(int a);
> >
> > foo.c -----------------
> >
> > #include <stdio.h>
> > #include "foo.h"
> >
> > int testvar = 0;
> >
> > int testfunc(int a)
> > {
> >         printf("%d\n",a);
> >         return 0;
> > }
> >
> > making... ----------------------------
> >
> > gcc -c foo.c -o foo.o
> > gcc -v -shared -Wl,--export-dynamic -Wl,--output-def=libfoo.def \
> >         -Wl,--out-implib=libfoo.dll.a -Wl,--enable-auto-image-base \
> >         --export-all-symbols -o libfoo.dll foo.o
> > Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-2/specs
> > gcc version 2.95.3-2 (cygwin special)
> >  /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-2/collect2.exe --shared
> -Bdynamic -e
> > __cygwin_dll_entry@12 --dll-search-prefix=cyg -o
> >
> > libfoo.dll -L/usr/lib/w32api -L/usr/local/lib -L/usr/lib
> -L/usr/lib/gcc-lib/
> > i686-pc-cygwin/2.95.3-2 --export-dynamic --outpu
> > t-def=libfoo.def --out-implib=libfoo.dll.a --enable-auto-image-base
> > foo.o -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshe
> > ll32 -lgcc
> > Cannot export _bss_end__: symbol not defined
> > Cannot export _bss_start__: symbol not defined
> > Cannot export _data_end__: symbol not defined
> > Cannot export _data_start__: symbol not defined
> > Creating library file: libfoo.dll.a
> > collect2: ld returned 1 exit status
> > make: *** [libfoo.dll] Error 1
> >
> > The resulting def file looks like this: -------------
> > EXPORTS
> >
> >     GetModuleHandleA@4 @1 DATA
> >     __CTOR_LIST__ @2 DATA
> >     __DTOR_LIST__ @3 DATA
> >     _bss_end__ DATA
> >     _bss_start__ DATA
> >     _cygwin_crt0_common@8 @4 DATA
> >     _cygwin_dll_entry@12 @5
> >     _cygwin_noncygwin_dll_entry@12 @6
> >     _data_end__ DATA
> >     _data_start__ DATA
> >     _fmode @7 DATA
> >     _head_libkernel32_a @8 DATA
> >     _head_templib_a @9 DATA
> >     _imp__GetModuleHandleA@4 @10 DATA
> >     _imp__calloc @11 DATA
> >     _imp__cygwin_detach_dll @12 DATA
> >     _imp__cygwin_internal @13 DATA
> >     _imp__dll_dllcrt0 @14 DATA
> >     _imp__free @15 DATA
> >     _imp__malloc @16 DATA
> >     _imp__printf @17 DATA
> >     _imp__realloc @18 DATA
> >     _impure_ptr @19 DATA
> >     calloc @20 DATA
> >     cygwin_attach_dll @21 DATA
> >     cygwin_detach_dll @22 DATA
> >     cygwin_internal @23 DATA
> >     cygwin_premain0 @24 DATA
> >     cygwin_premain1 @25 DATA
> >     cygwin_premain2 @26 DATA
> >     cygwin_premain3 @27 DATA
> >     dll_dllcrt0 @28 DATA
> >     environ @29 DATA
> >     free @30 DATA
> >     libkernel32_a_iname @31 DATA
> >     malloc @32 DATA
> >     printf @33 DATA
> >     realloc @34 DATA
> >     templib_a_iname @35 DATA
> >     testfunc @36
> >     testvar @37 DATA
> >
> > $ nm libfoo.dll.a | grep "T _"
> > 00000000 T _testfunc
> > 00000000 T __cygwin_noncygwin_dll_entry@12
> > 00000000 T __cygwin_dll_entry@12
> >
> > $ nm libfoo.dll.a | grep "testvar"
> > 00000000 I __imp__testvar
> >
> > Has anyone an idea what I can do to solve the problem ?
> >
> > Thanks
> >
> > Ralf Habacker
> > Germany
> >
> > --
> > Want to unsubscribe from this list?
> > Check out: http://cygwin.com/ml/#unsubscribe-simple
>

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple