This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: ld --wrap and zcat


Hi Shaun,

fstream::open in libstdc++ calls fopen in libc. I'd like to use ld --wrap to hook the fopen call to call popen to decompress a .gz file using zcat. Is this possible with ld --wrap? From my experimentation, it seems not. Is this possible using LD_PRELOAD and dlsym?

Do you have access to the linker command line used to build your executable ? If so you can just create your own custom library that contains its own implementation of fopen (which calls popen as you desire) and then insert the name of this library in between the libstdc++-v3 library and the libc library on the linker command line.


Cheers
  Nick



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