Same lib.so for reentrant and non-reentrant progs

Same lib.so for reentrant and non-reentrant progs

Post by Richard Smit » Fri, 04 Aug 2000 04:00:00



Hi Folks,
I am trying to build a dynamic library to replace both a static library
which supports legacy code, and a collection of the same routines which
has been recompiled with _REENTRANT defined to support some new code.
My problem is that the legacy code would need to use the non-reentrant
version of the routines, and the new code needs the reentrant versions.
How can I include both versions in the library, and assure that the
correct version is used in each case?
Does anyone know how the standard C library does this?  I don't see any
filters when I use "ldd", and I really don't want things to get that
complex if I can avoid it.
I am using Solaris 2.6, gcc, and the Solaris "ld" command.
Thanx,
Smiddy

 
 
 

Same lib.so for reentrant and non-reentrant progs

Post by Fletcher Glen » Fri, 04 Aug 2000 04:00:00


I don't think that you can combine two (or more) routines
with the same name in the same library.  The library has
no way to distinguish between the names.  The only time that
this will work is using C++ polymorphism where the routine
name is "mangled" to distinguish differences in call parameters.
If the routines only differ by content....well, you see what I
mean.

--
Fletcher Glenn
to reply remove NOSPAM from my reply address


> Hi Folks,
> I am trying to build a dynamic library to replace both a static library
> which supports legacy code, and a collection of the same routines which
> has been recompiled with _REENTRANT defined to support some new code.
> My problem is that the legacy code would need to use the non-reentrant
> version of the routines, and the new code needs the reentrant versions.
> How can I include both versions in the library, and assure that the
> correct version is used in each case?
> Does anyone know how the standard C library does this?  I don't see any
> filters when I use "ldd", and I really don't want things to get that
> complex if I can avoid it.
> I am using Solaris 2.6, gcc, and the Solaris "ld" command.
> Thanx,
> Smiddy



 
 
 

Same lib.so for reentrant and non-reentrant progs

Post by phil-news-nos.. » Fri, 04 Aug 2000 04:00:00



| I am trying to build a dynamic library to replace both a static library
| which supports legacy code, and a collection of the same routines which
| has been recompiled with _REENTRANT defined to support some new code.
| My problem is that the legacy code would need to use the non-reentrant
| version of the routines, and the new code needs the reentrant versions.
| How can I include both versions in the library, and assure that the
| correct version is used in each case?

Why does the legacy code need the non-reentrant version?  Have the
API or functional semantics changed?  Ordinarily, reentrant code
should work in cases where non-reentrant would, unless the caller
has become dependent on non-reentrant effects.

Basically, you'll need to make 2 different libraries.  Just set up
two Makefiles, one to build the reentrant library, and one to build
the non-reenentrant library.  If you can do it with common source,
that's fine.  Define a symbol for the C code to test if the code
needs to be different.  Be sure you don't get .o files mixed up.
One way to do that is to do actual builds into separate copied
directory trees from the pristine (uncompiled and clean) sources.

When compiling the application code, then just link them to the
appropriate library by the variant names.

--
| Phil Howard - KA9WGN | My current websites: linuxhomepage.com, ham.org
| phil  (at)  ipal.net +----------------------------------------------------

 
 
 

1. PS2-Mouse makes X non-reentrant ...

Has anyone had a similar Problem:
We are running XFree86 Version 3.1.2 on Linux version 2.0.0
(gcc version 2.7.0). /dev/mouse is linked to /dev/psaux, using a
Gigabyte-Pentium-Board, P133, with a builtin PS/2 Mouseport (IRQ 12),
Protocol in /etc/XF86Config is 'PS/2', other Protocols were nor working
at all.
X starts up ok,  switching to the Console works once, but trying to
switch back to X locks the Keyboard. We had gpm running, but kicked it
out, without resolving the problem. Linux itself is still alive, as
killing X over the network gives the keyboard back.
Windows95 running on the same System seems to have no Problems mith the
mouse.
The mouse is a Logitech 3-Button. A serial mouse works fine (after
reconfiguring /dev/mouse and /etc/XF86Config, of course ..)
Any suggestions (besides buying a serial mouse - it is nice to have two
fast serial Ports !)

Markus

Mail:


2. National ISPs and Linux?

3. Calling non-reentrant functions in signal handlers

4. missing memory

5. Reentrant C lib... okay to use w/o threads or "_r"??

6. Getting wireless USB adaptor (Netgear MA111) working with Fedora 3

7. reentrant X libs

8. saving with TIN

9. Help: need reentrant X libs

10. Sybase 12 Open Server seg fault with reentrant libs

11. Multithreading a non re-entrant library...

12. gethostby*(3) non re-entrant problem

13. Will using C++ strings be MT-safe and re-entrant ?