{"id":64810,"date":"2022-06-03T09:00:35","date_gmt":"2022-06-03T09:00:35","guid":{"rendered":"https:\/\/www.cryptocabaret.com\/?p=64810"},"modified":"2022-06-03T09:00:35","modified_gmt":"2022-06-03T09:00:35","slug":"how-static-linking-works-on-linux","status":"publish","type":"post","link":"https:\/\/www.cryptocabaret.com\/?p=64810","title":{"rendered":"How static linking works on Linux"},"content":{"rendered":"<p><span class=\"field field--name-title field--type-string field--label-hidden\">How static linking works on Linux<\/span><br \/>\n<span class=\"field field--name-uid field--type-entity-reference field--label-hidden\"><a title=\"View user profile.\" href=\"https:\/\/opensource.com\/users\/jayashree-huttanagoudar\" class=\"username\">Jayashree Hutt\u2026<\/a><\/span><br \/>\n<span class=\"field field--name-created field--type-created field--label-hidden\">Fri, 06\/03\/2022 &#8211; 03:00<\/span><\/p>\n<div data-drupal-selector=\"rate-node-70048\" class=\"rate-widget-thumbs-up\" title=\"Register or Login to like.\">\n<div class=\"rate-thumbs-up-btn-up vote-pending\"><a href=\"https:\/\/opensource.com\/user\/register\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?current=\/rss.xml\">Login<\/a> to like<\/div>\n<div class=\"rate-score\"><a href=\"https:\/\/opensource.com\/user\/register\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?current=\/rss.xml\">Login<\/a> to like<\/div>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item\">\n<p>Code for applications written using C usually has multiple source files, but ultimately you will need to compile them into a single executable.<\/p>\n<p>You can do this in two ways: by creating a <i>static<\/i> library or a <i>dynamic<\/i> library (also called a <i>shared<\/i> library). These two types of libraries vary in terms of how they are created and linked. Your choice of which to use depends on your use case.<\/p>\n<p>In a <a href=\"https:\/\/opensource.com\/article\/22\/5\/dynamic-linking-modular-libraries-linux\" target=\"_blank\" rel=\"noopener\">previous article<\/a>, I demonstrated how to create a dynamically linked executable, which is the more commonly used method. In this article, I explain how to create a statically linked executable.<\/p>\n<\/p>\n<div class=\"embedded-resource-list callout-float-right\">\n<div class=\"field field--name-title field--type-string field--label-hidden field__item\">Programming and development<\/div>\n<div class=\"field field--name-links field--type-link field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/?intcmp=7016000000127cYAAQ\">Red Hat Developers Blog<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/cheat-sheets?intcmp=7016000000127cYAAQ\">Programming cheat sheets<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/services\/training\/learning-subscription?intcmp=7016000000127cYAAQ\">Try for free: Red Hat Learning Subscription<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/bash-programming-guide?intcmp=7016000000127cYAAQ\">eBook: An introduction to programming with Bash<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/cheat-sheets\/bash-shell-cheat-sheet?intcmp=7016000000127cYAAQ\">Bash shell scripting cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/e-books\/modernizing-enterprise-java?intcmp=7016000000127cYAAQ\">eBook: Modernizing Enterprise Java<\/a><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<h2>Using a linker with static libraries<\/h2>\n<p>A linker is a command that combines several pieces of a program together and reorganizes the memory allocation for them.<\/p>\n<p>The functions of a linker include:<\/p>\n<ul>\n<li>Integrating all the pieces of a program<\/li>\n<li>Figuring out a new memory organization so that all the pieces fit together<\/li>\n<li>Reviving addresses so that the program can run under the new memory organization<\/li>\n<li>Resolving symbolic references<\/li>\n<\/ul>\n<p>As a result of all these linker functionalities, a runnable program called an <i>executable<\/i> is created.<\/p>\n<p>Static libraries are created by copying all necessary library modules used in a program into the final executable image. The linker links static libraries as a last step in the compilation process. An executable is created by resolving external references, combining the library routines with program code.<\/p>\n<h2>Create the object files<\/h2>\n<p>Here&#8217;s an example of a static library, along with the linking process. First, create the header file <code>mymath.h<\/code> with these function signatures:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"c geshifilter-c\"><span class=\"kw4\">int<\/span> add<span class=\"br0\">(<\/span><span class=\"kw4\">int<\/span> a<span class=\"sy0\">,<\/span> <span class=\"kw4\">int<\/span> b<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br><span class=\"kw4\">int<\/span> sub<span class=\"br0\">(<\/span><span class=\"kw4\">int<\/span> a<span class=\"sy0\">,<\/span> <span class=\"kw4\">int<\/span> b<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br><span class=\"kw4\">int<\/span> mult<span class=\"br0\">(<\/span><span class=\"kw4\">int<\/span> a<span class=\"sy0\">,<\/span> <span class=\"kw4\">int<\/span> b<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br><span class=\"kw4\">int<\/span> divi<span class=\"br0\">(<\/span><span class=\"kw4\">int<\/span> a<span class=\"sy0\">,<\/span> <span class=\"kw4\">int<\/span> b<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><\/div><\/div><\/pre>\n<p>Create <code>add.c<\/code>, <code>sub.c<\/code> , <code>mult.c<\/code> and <code>divi.c<\/code> with these function definitions:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"c geshifilter-c\"><span class=\"co1\">\/\/ add.c<\/span><br><span class=\"kw4\">int<\/span> add<span class=\"br0\">(<\/span><span class=\"kw4\">int<\/span> a<span class=\"sy0\">,<\/span> <span class=\"kw4\">int<\/span> b<span class=\"br0\">)<\/span><span class=\"br0\">{<\/span><br><span class=\"kw1\">return<\/span> <span class=\"br0\">(<\/span>a<span class=\"sy0\">+<\/span>b<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br><span class=\"br0\">}<\/span><br><br><span class=\"co1\">\/\/sub.c<\/span><br><span class=\"kw4\">int<\/span> sub<span class=\"br0\">(<\/span><span class=\"kw4\">int<\/span> a<span class=\"sy0\">,<\/span> <span class=\"kw4\">int<\/span> b<span class=\"br0\">)<\/span><span class=\"br0\">{<\/span><br><span class=\"kw1\">return<\/span> <span class=\"br0\">(<\/span>a<span class=\"sy0\">-<\/span>b<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br><span class=\"br0\">}<\/span><br><br><span class=\"co1\">\/\/mult.c<\/span><br><span class=\"kw4\">int<\/span> mult<span class=\"br0\">(<\/span><span class=\"kw4\">int<\/span> a<span class=\"sy0\">,<\/span> <span class=\"kw4\">int<\/span> b<span class=\"br0\">)<\/span><span class=\"br0\">{<\/span><br><span class=\"kw1\">return<\/span> <span class=\"br0\">(<\/span>a<span class=\"sy0\">*<\/span>b<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br><span class=\"br0\">}<\/span><br><br><span class=\"co1\">\/\/divi.c<\/span><br><span class=\"kw4\">int<\/span> divi<span class=\"br0\">(<\/span><span class=\"kw4\">int<\/span> a<span class=\"sy0\">,<\/span> <span class=\"kw4\">int<\/span> b<span class=\"br0\">)<\/span><span class=\"br0\">{<\/span><br><span class=\"kw1\">return<\/span> <span class=\"br0\">(<\/span>a<span class=\"sy0\">\/<\/span>b<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br><span class=\"br0\">}<\/span><\/div><\/div><\/pre>\n<p>Now generate object files <code>add.o<\/code>, <code>sub.o<\/code>, <code>mult.o<\/code>, and <code>divi.o<\/code> using GCC:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"bash geshifilter-bash\"><span class=\"co4\">$ <\/span><span class=\"kw2\">gcc<\/span> <span class=\"re5\">-c<\/span> add.c sub.c mult.c divi.c<\/code><\/span><\/pre>\n<p>The <code>-c<\/code> option skips the linking step and creates only object files.<\/p>\n<p>Create a static library called <code>libmymath.a<\/code>, then remove the object files, as they&#8217;re no longer required. (Note that using a <code>trash<\/code> <a href=\"https:\/\/www.redhat.com\/sysadmin\/recover-file-deletion-linux\" target=\"_blank\" rel=\"noopener\">command<\/a> is safer than <code>rm<\/code>.)<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\">$ <span class=\"kw2\">ar<\/span> rs libmymath.a add.o sub.o mult.o divi.o<br>\n$ trash <span class=\"sy0\">*<\/span>.o<br>\n$ <span class=\"kw2\">ls<\/span><br>\nadd.c \u00a0divi.c \u00a0libmymath.a \u00a0mult.c \u00a0mymath.h \u00a0sub.c<\/div><\/div><\/pre>\n<p>You have now created a simple example math library called <code>libmymath<\/code>, which you can use in C code. There are, of course, very complex C libraries out there, and this is the process their developers use to generate the final product that you and I install for use in C code.<\/p>\n<p>Next, use your math library in some custom code and then link it.<\/p>\n<h2>Create a statically linked application<\/h2>\n<p>Suppose you&#8217;ve written a command for mathematics. Create a file called <code>mathDemo.c<\/code> and paste this code into it:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"c geshifilter-c\"><span class=\"co2\">#include <mymath.h><\/mymath.h><\/span><br><span class=\"co2\">#include <stdio.h><\/stdio.h><\/span><br><span class=\"co2\">#include <stdlib.h><\/stdlib.h><\/span><br><br><span class=\"kw4\">int<\/span> main<span class=\"br0\">(<\/span><span class=\"br0\">)<\/span><br><span class=\"br0\">{<\/span><br>\n\u00a0 <span class=\"kw4\">int<\/span> x<span class=\"sy0\">,<\/span> y<span class=\"sy0\">;<\/span><br>\n\u00a0 <a href=\"http:\/\/www.opengroup.org\/onlinepubs\/009695399\/functions\/printf.html\"><span class=\"kw3\">printf<\/span><\/a><span class=\"br0\">(<\/span><span class=\"st0\">\"Enter two numbers<span class=\"es1\">n<\/span>\"<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br>\n\u00a0 <a href=\"http:\/\/www.opengroup.org\/onlinepubs\/009695399\/functions\/scanf.html\"><span class=\"kw3\">scanf<\/span><\/a><span class=\"br0\">(<\/span><span class=\"st0\">\"%d%d\"<\/span><span class=\"sy0\">,&amp;<\/span>x<span class=\"sy0\">,&amp;<\/span>y<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br>\n\u00a0<br>\n\u00a0 <a href=\"http:\/\/www.opengroup.org\/onlinepubs\/009695399\/functions\/printf.html\"><span class=\"kw3\">printf<\/span><\/a><span class=\"br0\">(<\/span><span class=\"st0\">\"<span class=\"es1\">n<\/span>%d + %d = %d\"<\/span><span class=\"sy0\">,<\/span> x<span class=\"sy0\">,<\/span> y<span class=\"sy0\">,<\/span> add<span class=\"br0\">(<\/span>x<span class=\"sy0\">,<\/span> y<span class=\"br0\">)<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br>\n\u00a0 <a href=\"http:\/\/www.opengroup.org\/onlinepubs\/009695399\/functions\/printf.html\"><span class=\"kw3\">printf<\/span><\/a><span class=\"br0\">(<\/span><span class=\"st0\">\"<span class=\"es1\">n<\/span>%d - %d = %d\"<\/span><span class=\"sy0\">,<\/span> x<span class=\"sy0\">,<\/span> y<span class=\"sy0\">,<\/span> sub<span class=\"br0\">(<\/span>x<span class=\"sy0\">,<\/span> y<span class=\"br0\">)<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br>\n\u00a0 <a href=\"http:\/\/www.opengroup.org\/onlinepubs\/009695399\/functions\/printf.html\"><span class=\"kw3\">printf<\/span><\/a><span class=\"br0\">(<\/span><span class=\"st0\">\"<span class=\"es1\">n<\/span>%d * %d = %d\"<\/span><span class=\"sy0\">,<\/span> x<span class=\"sy0\">,<\/span> y<span class=\"sy0\">,<\/span> mult<span class=\"br0\">(<\/span>x<span class=\"sy0\">,<\/span> y<span class=\"br0\">)<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br><br>\n\u00a0 <span class=\"kw1\">if<\/span><span class=\"br0\">(<\/span>y<span class=\"sy0\">==<\/span><span class=\"nu0\">0<\/span><span class=\"br0\">)<\/span><span class=\"br0\">{<\/span><br>\n\u00a0 \u00a0 <a href=\"http:\/\/www.opengroup.org\/onlinepubs\/009695399\/functions\/printf.html\"><span class=\"kw3\">printf<\/span><\/a><span class=\"br0\">(<\/span><span class=\"st0\">\"<span class=\"es1\">n<\/span>Denominator is zero so can't perform division<span class=\"es1\">n<\/span>\"<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br>\n\u00a0 \u00a0 \u00a0 <a href=\"http:\/\/www.opengroup.org\/onlinepubs\/009695399\/functions\/exit.html\"><span class=\"kw3\">exit<\/span><\/a><span class=\"br0\">(<\/span><span class=\"nu0\">0<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br>\n\u00a0 <span class=\"br0\">}<\/span><span class=\"kw1\">else<\/span><span class=\"br0\">{<\/span><br>\n\u00a0 \u00a0 \u00a0 <a href=\"http:\/\/www.opengroup.org\/onlinepubs\/009695399\/functions\/printf.html\"><span class=\"kw3\">printf<\/span><\/a><span class=\"br0\">(<\/span><span class=\"st0\">\"<span class=\"es1\">n<\/span>%d \/ %d = %d<span class=\"es1\">n<\/span>\"<\/span><span class=\"sy0\">,<\/span> x<span class=\"sy0\">,<\/span> y<span class=\"sy0\">,<\/span> divi<span class=\"br0\">(<\/span>x<span class=\"sy0\">,<\/span> y<span class=\"br0\">)<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br>\n\u00a0 \u00a0 \u00a0 <span class=\"kw1\">return<\/span> <span class=\"nu0\">0<\/span><span class=\"sy0\">;<\/span><br>\n\u00a0 <span class=\"br0\">}<\/span><br><span class=\"br0\">}<\/span><\/div><\/div><\/pre>\n<p>Notice that the first line is an <code>include<\/code> statement referencing, by name, your own <code>libmymath<\/code> library.<\/p>\n<p>Create an object file called <code>mathDemo.o<\/code> for <code>mathDemo.c<\/code>:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"bash geshifilter-bash\"><span class=\"co4\">$ <\/span><span class=\"kw2\">gcc<\/span> <span class=\"re5\">-I<\/span> . <span class=\"re5\">-c<\/span> mathDemo.c<\/code><\/span><\/pre>\n<p>The <code>-I <\/code>option tells GCC to search for header files listed after it. In this case, you&#8217;re specifying the current directory, represented by a single dot (<code>.<\/code>).<\/p>\n<p>Link <code>mathDemo.o<\/code> with <code>libmymath.a<\/code> to create the final executable. There are two ways to express this to GCC.<\/p>\n<p>You can point to the files:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"bash geshifilter-bash\"><span class=\"co4\">$ <\/span><span class=\"kw2\">gcc<\/span> <span class=\"re5\">-static<\/span> <span class=\"re5\">-o<\/span> mathDemo mathDemo.o libmymath.a<\/code><\/span><\/pre>\n<p>Alternately, you can specify the library path along with the library name:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"bash geshifilter-bash\"><span class=\"co4\">$ <\/span><span class=\"kw2\">gcc<\/span> <span class=\"re5\">-static<\/span> <span class=\"re5\">-o<\/span> mathDemo <span class=\"re5\">-L<\/span> . mathDemo.o <span class=\"re5\">-lmymath<\/span><\/code><\/span><\/pre>\n<p>In the latter example, the <code>-lmymath<\/code> option tells the linker to link the object files present in the <code>libmymath.a<\/code> with the object file <code>mathDemo.o<\/code> to create the final executable. The <code>-L<\/code> option directs the linker to look for libraries in the following argument (similar to what you would do with <code>-I<\/code>).<\/p>\n<h2>Analyzing the result<\/h2>\n<p>Confirm that it&#8217;s statically linked using the <code>file<\/code> command:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\">$ <span class=\"kw2\">file<\/span> mathDemo<br>\nmathDemo: ELF <span class=\"nu0\">64<\/span>-bit LSB executable, x86-<span class=\"nu0\">64<\/span>...<br>\nstatically linked, with debug_info, not stripped<\/div><\/div><\/pre>\n<p>Using the <code>ldd<\/code> command, you can see that the executable is not dynamically linked:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\">$ <span class=\"kw2\">ldd<\/span> .<span class=\"sy0\">\/<\/span>mathDemo<br>\n\u00a0 \u00a0 \u00a0 \u00a0 not a dynamic executable<\/div><\/div><\/pre>\n<p>You can also check the size of the <code>mathDemo<\/code> executable:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"c geshifilter-c\">$ du <span class=\"sy0\">-<\/span>h .<span class=\"sy0\">\/<\/span>mathDemo<br>\n932K \u00a0 \u00a0.<span class=\"sy0\">\/<\/span>mathDemo<\/div><\/div><\/pre>\n<p>In the example from my <a href=\"https:\/\/opensource.com\/article\/22\/5\/dynamic-linking-modular-libraries-linux\" target=\"_blank\" rel=\"noopener\">previous article<\/a>, the dynamic executable took up just 24K.<\/p>\n<p>Run the command to see it work:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\">$ .<span class=\"sy0\">\/<\/span>mathDemo<br>\nEnter two numbers<br><span class=\"nu0\">10<\/span><br><span class=\"nu0\">5<\/span><br><br><span class=\"nu0\">10<\/span> + <span class=\"nu0\">5<\/span> = <span class=\"nu0\">15<\/span><br><span class=\"nu0\">10<\/span> - <span class=\"nu0\">5<\/span> = <span class=\"nu0\">5<\/span><br><span class=\"nu0\">10<\/span> <span class=\"sy0\">*<\/span> <span class=\"nu0\">5<\/span> = <span class=\"nu0\">50<\/span><br><span class=\"nu0\">10<\/span> <span class=\"sy0\">\/<\/span> <span class=\"nu0\">5<\/span> = <span class=\"nu0\">2<\/span><\/div><\/div><\/pre>\n<p>Looks good!<\/p>\n<h2>When to use static linking<\/h2>\n<p>Dynamically linked executables are generally preferred over statically linked executables because dynamic linking keeps an application&#8217;s components modular. Should a library receive a critical security update, it can be easily patched because it exists outside of the applications that use it.<\/p>\n<p>When you use static linking, a library&#8217;s code gets &#8220;hidden&#8221; within the executable you create, meaning the only way to patch it is to re-compile and re-release a new executable every time a library gets an update\u2014and you have better things to do with your time, trust me.<\/p>\n<p>However, static linking is a reasonable option if the code of a library exists either in the same code base as the executable using it or in specialized embedded devices that are expected to receive no updates.<\/p>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-field-article-subhead field--type-text-long field--label-hidden field__item\">\n<p>Learn how to combine multiple C object files into a single executable with static libraries.<\/p>\n<\/div>\n<div class=\"field field--name-field-lead-image field--type-entity-reference field--label-hidden field__item\">\n<article class=\"media media--type-image media--view-mode-caption\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/06\/lenovo-thinkpad-laptop-concentration-focus-windows-office.png\" width=\"799\" height=\"447\" alt=\"Business woman on laptop sitting in front of window\" title=\"Woman using laptop concentrating\" loading=\"lazy\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>Image by Mapbox Uncharted ERG,\u00a0<a href=\"https:\/\/creativecommons.org\/licenses\/by\/3.0\/us\/\" rel=\"noreferrer nofollow noopener\" target=\"_blank\">CC-BY 3.0 US<\/a><\/p>\n<\/div>\n<\/article>\n<\/div>\n<div class=\"field field--name-field-tags field--type-entity-reference field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/programming\" hreflang=\"en\">Programming<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/linux\" hreflang=\"en\">Linux<\/a><\/div>\n<\/p><\/div>\n<div class=\"field field--name-field-listicle-title field--type-string field--label-hidden field__item\">What to read next<\/div>\n<div class=\"field field--name-field-listicles field--type-entity-reference field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/article\/22\/5\/dynamic-linking-modular-libraries-linux\" hreflang=\"en\">How dynamic linking for modular libraries works on Linux<\/a><\/div>\n<\/p><\/div>\n<div class=\"field field--name-field-default-license field--type-list-string field--label-hidden field__item\"><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\"><br \/>\n        <img decoding=\"async\" alt=\"Creative Commons License\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/06\/cc-by-sa-4-4.png\" title=\"This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.\"><\/a>This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.<\/div>\n<section class=\"field field--name-field-comments field--type-comment field--label-hidden comment-wrapper\">\n<div class=\"comments__count\">\n<div class=\"login\"><a href=\"https:\/\/opensource.com\/user\/register?absolute=1\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?current=\/rss.xml&amp;absolute=1\">Login<\/a> to post a comment.<\/div>\n<\/p><\/div>\n<\/section>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\" rel=\"noopener\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How static linking works on Linux Jayashree Hutt\u2026 Fri, 06\/03\/2022 &#8211; 03:00 Register or Login to like Register or Login to like Code for applications written using C usually has multiple source files, but ultimately you will need to compile them into a single executable. You can do this in two ways: by creating a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":64811,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[307],"tags":[],"class_list":["post-64810","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-open-source"],"_links":{"self":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/64810","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=64810"}],"version-history":[{"count":0,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/64810\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/media\/64811"}],"wp:attachment":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=64810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=64810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=64810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}