Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Dec 1994 12:22:04 -0700
From:      Nate Williams <nate@bsd.coe.montana.edu>
To:        current@freebsd.org, hackers@freebsd.org
Cc:        pk@netbsd.org
Subject:   Shared library question
Message-ID:  <199412191922.MAA15371@bsd.coe.montana.edu>

next in thread | raw e-mail | index | archive | help
What happens in our shlib implementation when the user supplies his own
version of a function that also appears in the shlib?

Made up example:

Let's say that the standard library has the function itoa, which is
prototypes as follows:

int itoa(char *retbuff, int num, int radix);

But, I have a need for an application which doesn't want to allocate a
buffer everytime the conversion since I'm writing the result out to the
screen via a very fast implementation of print which only writes out
strings and does no conversions.  My version of itoa contains a static
character buffer so it's prototype is:

char *itoa(int num);

I understand all the gotchas with the above implementation and realize
that I'm asking for trouble by using the same name, but it's for
explaining the problem.

When my program is linked, there is library code that uses the original
itoa and there is application code that uses my version of itoa.  Does
the program use the correct version of itoa, or does it only use my
version thus screwing up the library functions?

This is a big deal in the regex() function which depending on which
version you use there are multiple versions of regcomp() & regexec().

With the possibility of other libraries assuming one version (libedit
comes to mind) I could see lots of possibilities for strange errors if
an application happens to need the older interface and still wishes to
use the libedit features.

Thanks for the help,


Nate





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199412191922.MAA15371>