Re: weak symbols on Cygwin

2010-04-07 Thread Yaakov (Cygwin/X)
On 2010-04-07 04:06, Bruno Haible wrote: I was implicitly hoping that - gcc would collect all weak-declared symbols in some table, and generate code so that the reference to these symbols makes an indirection through this table, - the Cygwin runtime would call dlsym or GetProcAddr

Re: weak symbols on Cygwin

2010-04-07 Thread Bruno Haible
Dave Korn wrote: >> I've got some code, written for ELF platforms, that detects whether the >> pthread library (often a separate library from libc) is linked, by doing >> >> #pragma weak pthread_cancel >> bool pthread_in_use = (pthread_cancel != NULL); > > And you really need to determine this

Re: weak symbols on Cygwin

2010-04-07 Thread Dave Korn
On 07/04/2010 10:06, Bruno Haible wrote: > Thanks for these explanations. So, "#pragma weak" is very different on PE > systems than on ELF systems. Well, to be pedantically precise, "#pragma weak" is basically the same: it shuts the linker up from complaining about a symbol if no definition is

Re: weak symbols on Cygwin

2010-04-07 Thread Charles Wilson
On 4/7/2010 5:06 AM, Bruno Haible wrote: > I've got some code, written for ELF platforms, that detects whether the > pthread > library (often a separate library from libc) is linked, by doing > > #pragma weak pthread_cancel > bool pthread_in_use = (pthread_cancel != NULL); > > This code brea

Re: weak symbols on Cygwin

2010-04-07 Thread Bruno Haible
Hi Dave, > on ELF platforms, you can leave undefined references in an executable, to > be filled in by ld.so at runtime according to what the loader finds present > once it's loaded libc. > ... > On windows ... There's no run-time process of > scanning all available symbols from all loaded libr

Re: weak symbols on Cygwin

2010-04-06 Thread Dave Korn
ygwin, but the semantics of undefined weak symbols >> aren't identical to ELF platforms: a weak reference won't pull in an archive >> member that wouldn't otherwise be linked; the implications in relation to >> import libraries should be fairly obvious. > >

Re: weak symbols on Cygwin

2010-04-06 Thread Bruno Haible
Hi Dave, Dave Korn wrote: > >> These were all due to the fact that gcc 4.3.x on Cygwin 1.7.2 > >> accepts "#pragma weak foo", but the symbol foo then evaluates > >> to the NULL address, even if foo is defined in libc. > > > > Dave, are weak symbols something that should work on cygwin with new >