From: Robert Hoehne Newsgroups: comp.os.msdos.djgpp Subject: Re: [Q] wrapping functions with linker Date: Fri, 15 Aug 1997 13:15:15 +0200 Organization: TU Chemnitz-Zwickau Lines: 35 Message-ID: <33F43A43.6E6EF6B2@Mathematik.TU-Chemnitz.DE> References: <5stvfi$ffm$1 AT newton DOT pacific DOT net DOT sg> NNTP-Posting-Host: prokyon.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: > > When I'm trying to wrap malloc() related routines to use my functions > instead, I get this GPF. This is how I compile and run it : > > gcc -I. -Isrc -Wall -O -g -o obj/print.o -c print.c > gcc > -Wl,--wrap,malloc,--wrap,calloc,--wrap,cfree,--wrap,realloc,--wrap,free, > --wrap,xmalloc,--wrap,realloc,--wrap,xfree -o print.exe obj/print.o > -lm -lscan -lalleg -lpc Without seeing your sources I cannot say so much (and also I have no experiance with these --wrap things). But one hint: Have you carefully read the ld docs about this switch and have you tried at first the example shown there? > My programs run OK if I substitute those functions only in my source > and some of the libraries, but when I'm trying to substitute those > functions in all the libraries, than I'm getting this error. 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. 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 * *****************************************************************