🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1506

Re: Inversion-of-control and dependency-injection in C

#1506
From: fir
Date: Fri, 13 Nov 2026 09:18
61 lines
4573 bytes
Ross Finlayson pisze:
> Hello, dear C experts, I'm hoping you can tell me a story about
> modularity and composability, about the concerns of inversion-of-control
> and dependency-injection in C, basically about wiring
> test-time and run-time targets, for example about conditional-includes
> and various build-targets, probably mostly about function pointers.
> 
> A usual account for example might recount component frameworks,
> like COM or XPCOM for example, about the concepts of components,
> vis-a-vis, modularity and composability, and, satisfaction of
> dependencies, vis-a-vis IPC and RPC, abstraction layers often enough,
> then about adapters to dependencies, or as for resources, that
> it's a bunch of makefiles with various accounts of conditional includes
> and build targets about static and dynamic linking and the toolchain,
> with regards to test-harness and runtime-framework and about
> metaprogramming when making code generation and boilerplate and so on.
> 
> 
> Defining an interface or layer is often enough about groups of functions
> associated with context-structs to make for lifecycles
> of what result alike the pure virtual or abstract or interfaces
> in reference to languages like C++, about families of functions
> according to the types of their signatures, then as with regards
> to componentry rather generally in value-types and interface-types
> like "variant" and "queryInterface()", about components that implement
> multiple interfaces vis-a-vis mostly about "constructing the
> object-graph" what makes for separation-of-concerns and composability,
> is mostly about modularity and composability.
> 
> Then considerations of modularity as for library design affect to
> reflect on how to indicate responsibilities of ownership in resources,
> for example to hide contract & behavior of resources acquire/release.
> 
> What I'm figuring is that basically there is a flat name-space of
> functions, there are .h and .c files (and may include "portable
> assembler"), and there is the compiler-toolchain, and make or
> build-scripts. Since there are only functions then dependencies their
> references would basically live in structs (in structs, in structs, ...,
> of function pointers), much like languages with classes and their
> instances objects and subclassing overriding behavior keeping in
> contract, about how to define "runtime-module" vis-a-vis "source module"
> (.o files after compilation-units), about conditional-includes
> and conditional-builds vis-a-vis name-mangling or the conventions of
> symbols.
> 
> What, whither, when, how?
> 

overally yours pyramide of this soft youre talkin about is build from 
small blocks/pieces (i dont mean pieces of code but some design pices 
(like alos this you mentioned dependency injection, inversion of 
controll and more)

if you want answers ask some specific things on those pieces..asking
on whole pyramid may be stupid as this stack of youre is probably quite
specyfic - i would guess you have so many bad design decision stacked 
its in some wayj hopeless ;c (thoug hopeless is obviously an exagerration)

i dont stack the bulshit and even in my case probblems appear when 
program is getting bigger
Technical Details
Message-ID: <11d6kmh$mj47$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <yQOdnQ-qnKiiZ2j3nZ2dnZfqn_udnZ2d@giganews.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: fir <profesor.fir@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: Inversion-of-control and dependency-injection in C
Date: Fri, 13 Nov 2026 10:18:40 +0100
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <11d6kmh$mj47$1@dont-email.me>
References: <yQOdnQ-qnKiiZ2j3nZ2dnZfqn_udnZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 13 Nov 2026 09:19:13 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="740487"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18isVmsk69fVogvMU45ddXGHRRoKqLnY14="; posting-host="da7859bec363c0557c2f8c5e9a05ecef"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101
 Firefox/140.0 SeaMonkey/2.53.24
Cancel-Lock: sha1:AHlYBxfLDNTNQHsUWjvtL0+WU7c= sha256:lFfZfd9jSQbhYuOKRcArgDfLVF/k4noQ6rKIHHaAxns=
	sha1:vQBAh9mfKyl6FZNJ4NH+bBobHTg= sha256:5+o4M3omE3v8Re06yGHqvfQTnjl3S0d6+Z1RxURMte4=
In-Reply-To: <yQOdnQ-qnKiiZ2j3nZ2dnZfqn_udnZ2d@giganews.com>