public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Help Needed: How to overwrite library functions.
@ 2002-03-20 12:16 Mynampati, Venkata S.
  2002-03-21  3:56 ` zhenglonggen
  0 siblings, 1 reply; 6+ messages in thread
From: Mynampati, Venkata S. @ 2002-03-20 12:16 UTC (permalink / raw)
  To: 'Kayvan A. Sylvan'; +Cc: 'gcc-help@gcc.gnu.org'

> 
> 
> On Wed, Mar 20, 2002 at 01:56:38PM -0600, Mynampati, Venkata S. wrote:
> > > On Wed, Mar 20, 2002 at 10:38:52AM -0600, Mynampati, 
> Venkata S. wrote:
> > > > Hi,
> > > > I have this issue where i have an archive, whose member
> > > > "1.o" contains functions named A(), B(), C().
> > > > Now, i want to write a module, in which i want to use A() , BUT
> > > > overwrite B() and C() and YET link both "1.o" and my own module
> > > > together with rest of the system.
> > > > 
> > > > i.e
> > > > 1.o contains A(), B() and C()
> > > > say 2.o contains my_A(), B(), C(), where
> > > >  my_A()
> > > >  {
> > > >     /*do something*/;
> > > >     A();			=> linked from 1.o
> > > >  }
> > > > 
> > > > Thanks for your time and help.
> > > > Regards,
> > > > Venkat
> > > > Worry about chances you miss when you don't even try.
> > > >   
> > > 
> > > This is probably a job for the preprocessor.
> > > 
> > > #define B my_replacement_B
> > > #define C my_replacement_C
> > > 
> > > Then code up my_replacement_B() and my_replacement_C() 
> with the same
> > > API as B() and C()
> > > 
> > Nope, my file's fucntion names are in conflict with a library (*.a)
> > and it spews out error while linking.
> 
> I don't see how. Can you send a short example file?
> 
I have a library named libmem.a which contains a file named
mem.o, which has functions named malloc() free() memPartFree() etc.
Now i want to replace memPartFree90, but want to use malloc() and free().
How can do that? 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help Needed: How to overwrite library functions.
  2002-03-20 12:16 Help Needed: How to overwrite library functions Mynampati, Venkata S.
@ 2002-03-21  3:56 ` zhenglonggen
  0 siblings, 0 replies; 6+ messages in thread
From: zhenglonggen @ 2002-03-21  3:56 UTC (permalink / raw)
  To: MynamVS; +Cc: kayvan, gcc-help

   I have a library named libmem.a which contains a file named
   mem.o, which has functions named malloc() free() memPartFree() etc.
   Now i want to replace memPartFree90, but want to use malloc() and free().
   How can do that? 

You should put the object file containing memPartFree90() in front of libmem.a 
in the option list of ld command so that ld will first link your memPartFree90 
into object file, and when it finds malloc() free() missing, it will look for them
in  other object files ; My experience tells me it will work.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help Needed: How to overwrite library functions.
  2002-03-20 11:57 Mynampati, Venkata S.
@ 2002-03-20 12:05 ` Kayvan A. Sylvan
  0 siblings, 0 replies; 6+ messages in thread
From: Kayvan A. Sylvan @ 2002-03-20 12:05 UTC (permalink / raw)
  To: Mynampati, Venkata S.; +Cc: 'gcc-help@gcc.gnu.org'

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]

On Wed, Mar 20, 2002 at 01:56:38PM -0600, Mynampati, Venkata S. wrote:
> > On Wed, Mar 20, 2002 at 10:38:52AM -0600, Mynampati, Venkata S. wrote:
> > > Hi,
> > > I have this issue where i have an archive, whose member
> > > "1.o" contains functions named A(), B(), C().
> > > Now, i want to write a module, in which i want to use A() , BUT
> > > overwrite B() and C() and YET link both "1.o" and my own module
> > > together with rest of the system.
> > > 
> > > i.e
> > > 1.o contains A(), B() and C()
> > > say 2.o contains my_A(), B(), C(), where
> > >  my_A()
> > >  {
> > >     /*do something*/;
> > >     A();			=> linked from 1.o
> > >  }
> > > 
> > > Thanks for your time and help.
> > > Regards,
> > > Venkat
> > > Worry about chances you miss when you don't even try.
> > >   
> > 
> > This is probably a job for the preprocessor.
> > 
> > #define B my_replacement_B
> > #define C my_replacement_C
> > 
> > Then code up my_replacement_B() and my_replacement_C() with the same
> > API as B() and C()
> > 
> Nope, my file's fucntion names are in conflict with a library (*.a)
> and it spews out error while linking.

I don't see how. Can you send a short example file?

-- 
Kayvan A. Sylvan          | Proud husband of       | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Help Needed: How to overwrite library functions.
@ 2002-03-20 11:57 Mynampati, Venkata S.
  2002-03-20 12:05 ` Kayvan A. Sylvan
  0 siblings, 1 reply; 6+ messages in thread
From: Mynampati, Venkata S. @ 2002-03-20 11:57 UTC (permalink / raw)
  To: 'Kayvan A. Sylvan'; +Cc: 'gcc-help@gcc.gnu.org'

> On Wed, Mar 20, 2002 at 10:38:52AM -0600, Mynampati, Venkata S. wrote:
> > Hi,
> > I have this issue where i have an archive, whose member
> > "1.o" contains functions named A(), B(), C().
> > Now, i want to write a module, in which i want to use A() , BUT
> > overwrite B() and C() and YET link both "1.o" and my own module
> > together with rest of the system.
> > 
> > i.e
> > 1.o contains A(), B() and C()
> > say 2.o contains my_A(), B(), C(), where
> >  my_A()
> >  {
> >     /*do something*/;
> >     A();			=> linked from 1.o
> >  }
> > 
> > Thanks for your time and help.
> > Regards,
> > Venkat
> > Worry about chances you miss when you don't even try.
> >   
> 
> This is probably a job for the preprocessor.
> 
> #define B my_replacement_B
> #define C my_replacement_C
> 
> Then code up my_replacement_B() and my_replacement_C() with the same
> API as B() and C()
> 
Nope, my file's fucntion names are in conflict with a library (*.a)
and it spews out error while linking.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Help Needed: How to overwrite library functions.
  2002-03-20  8:38 Mynampati, Venkata S.
@ 2002-03-20 11:38 ` Kayvan A. Sylvan
  0 siblings, 0 replies; 6+ messages in thread
From: Kayvan A. Sylvan @ 2002-03-20 11:38 UTC (permalink / raw)
  To: Mynampati, Venkata S.; +Cc: 'gcc-help@gcc.gnu.org'

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

On Wed, Mar 20, 2002 at 10:38:52AM -0600, Mynampati, Venkata S. wrote:
> Hi,
> I have this issue where i have an archive, whose member
> "1.o" contains functions named A(), B(), C().
> Now, i want to write a module, in which i want to use A() , BUT
> overwrite B() and C() and YET link both "1.o" and my own module
> together with rest of the system.
> 
> i.e
> 1.o contains A(), B() and C()
> say 2.o contains my_A(), B(), C(), where
>  my_A()
>  {
>     /*do something*/;
>     A();			=> linked from 1.o
>  }
> 
> Thanks for your time and help.
> Regards,
> Venkat
> Worry about chances you miss when you don't even try.
>   

This is probably a job for the preprocessor.

#define B my_replacement_B
#define C my_replacement_C

Then code up my_replacement_B() and my_replacement_C() with the same
API as B() and C()

-- 
Kayvan A. Sylvan          | Proud husband of       | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Help Needed: How to overwrite library functions.
@ 2002-03-20  8:38 Mynampati, Venkata S.
  2002-03-20 11:38 ` Kayvan A. Sylvan
  0 siblings, 1 reply; 6+ messages in thread
From: Mynampati, Venkata S. @ 2002-03-20  8:38 UTC (permalink / raw)
  To: 'gcc-help@gcc.gnu.org'; +Cc: Mynampati, Venkata S.

Hi,
I have this issue where i have an archive, whose member
"1.o" contains functions named A(), B(), C().
Now, i want to write a module, in which i want to use A() , BUT
overwrite B() and C() and YET link both "1.o" and my own module
together with rest of the system.

i.e
1.o contains A(), B() and C()
say 2.o contains my_A(), B(), C(), where
 my_A()
 {
    /*do something*/;
    A();			=> linked from 1.o
 }

Thanks for your time and help.
Regards,
Venkat
Worry about chances you miss when you don't even try.
  

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-03-21 11:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-20 12:16 Help Needed: How to overwrite library functions Mynampati, Venkata S.
2002-03-21  3:56 ` zhenglonggen
  -- strict thread matches above, loose matches on Subject: below --
2002-03-20 11:57 Mynampati, Venkata S.
2002-03-20 12:05 ` Kayvan A. Sylvan
2002-03-20  8:38 Mynampati, Venkata S.
2002-03-20 11:38 ` Kayvan A. Sylvan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).