<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Libraries on Sandeep Kumar</title><link>https://sandeep007734.github.io/tags/libraries/</link><description>Recent content in Libraries on Sandeep Kumar</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 04 Dec 2025 00:00:00 +0530</lastBuildDate><atom:link href="https://sandeep007734.github.io/tags/libraries/feed.xml" rel="self" type="application/rss+xml"/><item><title>Library Calling in C</title><link>https://sandeep007734.github.io/posts/lib-calling/</link><pubDate>Wed, 01 May 2019 00:00:00 +0530</pubDate><guid>https://sandeep007734.github.io/posts/lib-calling/</guid><description>&lt;p&gt;In this post we are exploring how different types of binaries are generated, how function calls work when code is split across multiple files, and how the toolchain (compiler, linker, loader) helps. We&amp;rsquo;ll also cover how to build and install a custom libc for testing and debugging purposes.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="file-types-and-high-level-flow"&gt;File Types and High-Level Flow&lt;/h2&gt;
&lt;p&gt;Difference in types of files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;.c&lt;/code&gt; / &lt;code&gt;.cpp&lt;/code&gt;: source files&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.o&lt;/code&gt;: object files (compiled but not yet linked)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.a&lt;/code&gt;: static library (archive of &lt;code&gt;.o&lt;/code&gt; files)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.so&lt;/code&gt;: shared library (dynamically linked at runtime)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Typical build pipeline:&lt;/p&gt;</description></item><item><title>Installing custom LibC</title><link>https://sandeep007734.github.io/posts/custom-libc/</link><pubDate>Mon, 09 Mar 2020 00:00:00 +0530</pubDate><guid>https://sandeep007734.github.io/posts/custom-libc/</guid><description>&lt;p&gt;Glibc is the standard library that is linked against all the linux applications. It provides the necessary functionality like &lt;em&gt;printf&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;It also provides wrappers for most used system calls like &lt;em&gt;open, read, write, close&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id="manually-building-and-installing-libc"&gt;Manually building and installing libc.&lt;/h2&gt;
&lt;p&gt;Example from a &lt;a href="https://stackoverflow.com/questions/10412684/how-to-compile-my-own-glibc-c-standard-library-from-source-and-use-it"&gt;StackOverflow answer&lt;/a&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-console" data-lang="console"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="go"&gt;export glibc_install=&amp;#34;$(pwd)/glibc/build/install&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="go"&gt;git clone git://sourceware.org/git/glibc.git
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="go"&gt;cd glibc
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="go"&gt;git checkout glibc-2.28
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="go"&gt;mkdir build
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="go"&gt;cd build
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="go"&gt;../configure --prefix &amp;#34;$glibc_install&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="go"&gt;make
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="go"&gt;make install
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Followed by a test c code&lt;/p&gt;</description></item></channel></rss>