On 21 March 2007 16:09, Richard Henderson wrote: > On Wed, Mar 21, 2007 at 01:11:36PM +0100, Kai Tietz wrote: >> #include <stdlib.h> >> 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__malloc". But the import library has also the not >> decored name stub function "_malloc". Did I something wrong or is there >> something broken ? > > In i386_pe_mark_dllimport, we turn "malloc" into "*__imp_malloc", > and the later is not constant. I expect we'd have to expand this > differently if you wanted to make use of import library stubs.
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? cheers, DaveK -- Can't think of a witty .sigline today....