From: Robert Hoehne Newsgroups: comp.os.msdos.djgpp Subject: Re: [Q] wrapping functions with linker Date: Mon, 18 Aug 1997 11:18:44 +0200 Organization: TU Chemnitz-Zwickau Lines: 44 Message-ID: <33F81374.7D6987A7@Mathematik.TU-Chemnitz.DE> References: <5stvfi$ffm$1 AT newton DOT pacific DOT net DOT sg> <33F43A43 DOT 6E6EF6B2 AT Mathematik DOT TU-Chemnitz DOT DE> <33f54e90 DOT 1752245 AT news DOT pacific DOT net DOT sg> NNTP-Posting-Host: rigel.hrz.tu-chemnitz.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Victor wrote: > > On Fri, 15 Aug 1997 13:15:15 +0200, Robert Hoehne > wrote: > > >What do you mean with "substituting in my source and some of > >the libarries" ? As far as understand this switch of ld, you have > >nothing to substitute, but only to provide your wrapper functions > >and then link with the --wrap option. > > I meant writing > #define malloc(a) mymalloc(a) > in the library's header and recompiling it (and of course, providing > mymalloc() function which will substitute malloc()). Here is probably a misunderstanding of you what the --wrap switch does. PLEASE read the ld doc about this switch. And as I said already, try at first the example from the ld docs (which is in that case a sample for wrapping the malloc function) and then adapt or extent it to all the other functions you want to wrap. In general again. If you use the --wrap option and you provide in your soures the correct wrap-function you have not to change anything in the libraries, this is done automatically by the linker. That means again, you have NOT to do any #define malloc(x) mymallox(x) or something like this. If all of this does not help you (or you don't understand), please post a short example of code with an as detailed as possible description what you want to get and I will try if I can get you more specific help. Robert --- ***************************************************************** * Robert Hoehne, Fakultaet fuer Mathematik, TU-Chemnitz-Zwickau * * Post: Am Berg 3, D-09573 Dittmannsdorf * * e-Mail: Robert DOT Hoehne AT Mathematik DOT TU-Chemnitz DOT DE * * WWW: http://www.tu-chemnitz.de/~rho * *****************************************************************