SHARE
Facebook X Pinterest WhatsApp

IBM developerWorks: Override the GNU C Library–Painlessly

Written By
thumbnail
Web Webster
Web Webster
May 20, 2002

[ Thanks to Maria
for this link. ]

“What do you do if you don’t have the source for your
application and it’s failing because a GNU Library for C (glibc)
function is returning something bad to the application? Because
glibc is open-source, you can of course get the source code, make
your changes, rebuild, and install. This is not for the faint of
heart, however, because although the API is well documented, the
internal organization of the GNU C library is not. Finding the
correct function prototypes is only the first of many challenges.
It’s a big package as well, so the first time you compile, it will
take some time (glibc 2.2.2 has 8,552 files and 1,775,440 lines of
code, including comments).

“Better than rebuilding glibc is selectively overriding a
function. Many of the modern Unixes support the concept of
preloading user defined libraries. These libraries can be either
complete replacements (that is, a private version of glibc) or
subsets — even a single function. You can use a private version of
glibc by setting the LD_LIBRARY_PATH to include your private
version of the library first. You can use a subset of library
routines that you write by using the LD_PRELOAD environmental
value. Both LD_LIBRARY_PATH and LD_PRELOAD are controlled by the
dynamic ELF linker/loader. It uses a first match to satisfy any
symbol name. By preloading your version of a library or function
you short circuit the normal path, allowing you to override
it…”


Complete Story

thumbnail
Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Recommended for you...

Red Hat reveals major enhancements to Red Hat Enterprise Linux AI
sjvn
Oct 22, 2024
How to Find AWS EC2 Instance Type Over SSH (6 Methods)
Benny Lanco
Sep 23, 2024
Crond: Daemon to Execute Scheduled Commands
Rose Hosting Blog
Sep 20, 2024
A Detailed Introduction to Oracle VirtualBox
Senthil Kumar
Sep 19, 2024
Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.