<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
	<title>One&#39;s sustainable corner in the Wired</title>
	<link>https://doomguy69.codeberg.page/</link>
	<description>Recent content in One&#39;s sustainable cyber-corner in the Wired on One&#39;s sustainable corner in the Wired</description>
	<generator>Hugo -- gohugo.io</generator>
	<language>en-us</language>
	<lastBuildDate>Sat, 19 Sep 2026 11:13:57 +0100</lastBuildDate>
    
        <atom:link href="https://doomguy69.codeberg.page/index.xml" rel="self" type="application/rss+xml" />
	
	
	<item>
		<title>Make your libraries in simple C!!!</title>
		<link>https://doomguy69.codeberg.page/articles/cpp_libraries/</link>
		<pubDate>Sat, 19 Sep 2026 14:18:03 +0100</pubDate>
		
		<guid>https://doomguy69.codeberg.page/articles/cpp_libraries/</guid>
		<description>&lt;p&gt;Whenever I try to use a C++ library, no matter how simple the API is it&amp;rsquo;s just a pain
to get it working with any other language. There are a couple of examples I can think
of (Dear ImGui, Tracy, vst3sdk&amp;hellip;).&lt;/p&gt;
&lt;p&gt;If a programmer wants to use a C++ library from another language, they&amp;rsquo;ll have to link
with the library seperately and use a C API header file (see
&lt;a href=&#34;https://github.com/cimgui/cimgui&#34;&gt;cimgui&lt;/a&gt;,
&lt;a href=&#34;https://github.com/wolfpld/tracy&#34;&gt;tracy&lt;/a&gt;).
Making bindings will require interfacing with libc++/libstdc++ too (see &lt;a href=&#34;https://github.com/Capati/odin-imgui&#34;&gt;odin-imgui&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://doomguy69.codeberg.page/images/tracy.png&#34; alt=&#34;Tracy Documentation on their C API&#34;&gt;&lt;/p&gt;
&lt;p&gt;It may go around the other way, so trying to use a C library in a C++ project doesn&amp;rsquo;t work
because the library doesn&amp;rsquo;t cast pointers!&lt;/p&gt;
&lt;p&gt;The &lt;a href=&#34;https://github.com/nothings/stb&#34;&gt;stb&lt;/a&gt; libraries are a perfect example of libraries that
work everywhere, seriously go try all the compilers (msvc, gcc, clang, tcc&amp;hellip;), standards (from C95 to C23)
and OSes. You can compile and link them however you want and it&amp;rsquo;s extremely easy to do so.&lt;/p&gt;
&lt;p&gt;We need more C libraries that are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Compatible with all the C standards (from C95 to C23, preferrably C89 support too).&lt;/li&gt;
&lt;li&gt;Compatible with C++ (will make this into a seperate blog post).&lt;/li&gt;
&lt;li&gt;Works with most compilers (preferably don&amp;rsquo;t rely on compiler extensions except for things like thread local).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is also one of the advantages of using standard C89/C99, you&amp;rsquo;re (mostly) compatible with all
other C standards, and the library doesn&amp;rsquo;t rely on implicit primitive/pointer casts and has a macro
for both C and C++ initializers, now you&amp;rsquo;re library is compatible with C++ too! (there may be other
details I&amp;rsquo;m missing, but those are for another blog post).&lt;/p&gt;
&lt;p&gt;Now here is another thing: if I want to write a really portable C library, what C standard should
it use? It depends: If the library is expected to run in embedded environments, then C89 is the
obvious choice, but other than that C99 is more than fine portability-wise.&lt;/p&gt;
&lt;p&gt;That raises the question: what&amp;rsquo;s the difference between using C89 and C99 anyway? All that comes to mind
when thinking of C99 is inlining (compilers do that anyway), VLAs (optional in C11, therefore bad for portability),
one line comments (not that big of a deal), designated initializers (which are quite nice when writing, say,
Vulkan structs but also not a big deal) and compound literals (not a big deal since C89 allows inserting
scopes inside functions). C99 is just for comfort&amp;hellip; But it&amp;rsquo;s OK since C99 is pretty portable, unless you&amp;rsquo;re
really that portable and want to support all sorts of C compilers (Plan9&amp;rsquo;s C compiler perhaps?).&lt;/p&gt;
&lt;h1 id=&#34;conclusion&#34;&gt;Conclusion:&lt;/h1&gt;
&lt;p&gt;If writing a library, write standard C89/C99 that is compatible with C++, doesn&amp;rsquo;t use compiler extensions
(unless it&amp;rsquo;s &lt;em&gt;really&lt;/em&gt; needed), and works with most compilers (bonus points if it works with tcc or cproc).&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Projects</title>
		<link>https://doomguy69.codeberg.page/projects/</link>
		<pubDate>Sat, 19 Sep 2026 14:16:14 +0100</pubDate>
		
		<guid>https://doomguy69.codeberg.page/projects/</guid>
		<description>&lt;p&gt;none lmaoooo&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Music</title>
		<link>https://doomguy69.codeberg.page/music/</link>
		<pubDate>Sat, 19 Sep 2026 14:16:11 +0100</pubDate>
		
		<guid>https://doomguy69.codeberg.page/music/</guid>
		<description>&lt;p&gt;uuh later cant be fucked to rn&lt;/p&gt;
</description>
	</item>
	
	</channel>
</rss>
