overloading functions

Is there a method to over load functions in C (or to fake it). I have a
function listen() that was created by a third party and that we use
extensively throughout our project. I am currently implementing a new module
that requires both the TCP/IP library listen() and our current listen().
Other than renaming one (ours), is there a method to allow both instances
within the same program?

Thanks in advance.

Doug

“Doug Rixmann” <rixmannd@rdsdata.com> wrote in message
news:a9hmuu$a07$1@inn.qnx.com

Is there a method to over load functions in C (or to fake it). I have a
function listen() that was created by a third party and that we use
extensively throughout our project. I am currently implementing a new
module
that requires both the TCP/IP library listen() and our current listen().
Other than renaming one (ours), is there a method to allow both instances
within the same program?

I don’t see how.

Thanks in advance.

Doug

didn’t think so… thanks
“Mario Charest” <goto@nothingness.com> wrote in message
news:a9hpjv$c31$1@inn.qnx.com

“Doug Rixmann” <> rixmannd@rdsdata.com> > wrote in message
news:a9hmuu$a07$> 1@inn.qnx.com> …
Is there a method to over load functions in C (or to fake it). I have a
function listen() that was created by a third party and that we use
extensively throughout our project. I am currently implementing a new
module
that requires both the TCP/IP library listen() and our current listen().
Other than renaming one (ours), is there a method to allow both
instances
within the same program?

I don’t see how.


Thanks in advance.

Doug
\

Mario Charest wrote:


I don’t see how.

Couldn’t you overload with linking (ala malloc debugging libs).

Rennie

Rennie Allen <rallen@csical.com> wrote:

Mario Charest wrote:



I don’t see how.



Couldn’t you overload with linking (ala malloc debugging libs).

malloc is a complete replacement. He wants to be able to call both
from the application, sometimes one, sometimes the other.

I also can’t see any way of doing this.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Doug Rixmann <rixmannd@rdsdata.com> wrote:

Is there a method to over load functions in C (or to fake it). I have a
function listen() that was created by a third party and that we use
extensively throughout our project. I am currently implementing a new module
that requires both the TCP/IP library listen() and our current listen().
Other than renaming one (ours), is there a method to allow both instances
within the same program?

Renaming isn’t that bad in a .h file…

In the .h file:
#define listen my_listen

In a .c file:
#undef listen
my_listen ()
{
if (cond) {
listen ();
} else {
other_listen ();
}
}

Hey, it’s a kludge, but… :slight_smile:

Cheers,
-RK


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.