RE: i386: Problems with references to import symbols.

2007-03-21 Thread Danny Smith
Richard Henderson wrote > On Wed, Mar 21, 2007 at 04:16:20PM -, Dave Korn wrote: > > Presumably there would be no problem in just waiting > until runtime to > > initialise the my_malloc_hook variable dynamically instead > of trying to > > statically initialise it? > > Dunno. One could al

Re: i386: Problems with references to import symbols.

2007-03-21 Thread Ross Ridge
Richard Henderson writes: >Dunno. One could also wait to expand *__imp_foo, for functions, >until expanding the function call. And then this variable would >receive the address of the import library thunk. > >What does VC++ do? It seems to always use *__imp_foo except when initializing a static

Re: i386: Problems with references to import symbols.

2007-03-21 Thread Richard Henderson
On Wed, Mar 21, 2007 at 04:16:20PM -, Dave Korn wrote: > Presumably there would be no problem in just waiting until runtime to > initialise the my_malloc_hook variable dynamically instead of trying to > statically initialise it? Dunno. One could also wait to expand *__imp_foo, for functions

Re: i386: Problems with references to import symbols.

2007-03-21 Thread Kai Tietz
Richard Henderson <[EMAIL PROTECTED]> wrote on 21.03.2007 17:09:26: > On Wed, Mar 21, 2007 at 01:11:36PM +0100, Kai Tietz wrote: > > #include > > void *(my_malloc_hook)(size_t) = malloc; > > > > GCC tells me, that malloc isn't a constant symbol. Clear malloc is defined > > by using the attribu

RE: i386: Problems with references to import symbols.

2007-03-21 Thread Dave Korn
On 21 March 2007 16:09, Richard Henderson wrote: > On Wed, Mar 21, 2007 at 01:11:36PM +0100, Kai Tietz wrote: >> #include >> void *(my_malloc_hook)(size_t) = malloc; >> >> GCC tells me, that malloc isn't a constant symbol. Clear malloc is defined >> by using the attribute dllimport, because it c

Re: i386: Problems with references to import symbols.

2007-03-21 Thread Richard Henderson
On Wed, Mar 21, 2007 at 01:11:36PM +0100, Kai Tietz wrote: > #include > void *(my_malloc_hook)(size_t) = malloc; > > GCC tells me, that malloc isn't a constant symbol. Clear malloc is defined > by using the attribute dllimport, because it comes out of the MSVCRT and > has the name "__imp__mallo

i386: Problems with references to import symbols.

2007-03-21 Thread Kai Tietz
Hello, I stumbled over the following problem in current gcc trunk version for minw32. If I try something like: #include void *(my_malloc_hook)(size_t) = malloc; GCC tells me, that malloc isn't a constant symbol. Clear malloc is defined by using the attribute dllimport, because it comes out of