Article View: comp.lang.c
Article #1489Re: Inversion-of-control and dependency-injection in C
From: fir
Date: Thu, 12 Nov 2026 19:39
Date: Thu, 12 Nov 2026 19:39
83 lines
5455 bytes
5455 bytes
fir pisze: > 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? >> > > this is not a large group and stating such soecific and wide question > you minimalise the chance of answers to it to nearly zero > > you can enentually "answer to yourself" (as some say i do? well if i > state question and some cant answer it after some time i myself may > answer it) - though im usually not answering my own questions > (sometimes) but simply "adding" more thoughts to prewious ones > (which is qute good coz articles splitted on more parts ere better) > > overally people seem to ba rather weak in answering some more 'meta' questions (which is not strightforward as in the net (articles etc) i sometimes see lile people would be interested in meta topic to, but on c.l.c meta questions are rarely answered) if they will do i mayself would ask: have you noticed that mess rises in your code/projects ? what you do with that for exampel in my rasterizer/3d shooter prototype i read keys - it comes from wndproc key handler but as code grows larger damn i got not in memory where given key ich checked (as its handy and logical to check it close to its functionality, sometimes it is in general window handling, sometimes its in hud block, sometimes its in the scene root area sometimes its in the loop of objests good luck to finding it and that is how mess grows (its maybe not even mess - its maybe things dont fit in my memory so i must load it, and damn its slow
Technical Details
Message-ID:
<11d54m7$8329$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-mailReferences:
<yQOdnQ-qnKiiZ2j3nZ2dnZfqn_udnZ2d@giganews.com> <11d53si$7o8t$1@dont-email.me>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: Thu, 12 Nov 2026 20:39:21 +0100 Organization: A noiseless patient Spider Lines: 83 Message-ID: <11d54m7$8329$1@dont-email.me> References: <yQOdnQ-qnKiiZ2j3nZ2dnZfqn_udnZ2d@giganews.com> <11d53si$7o8t$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 12 Nov 2026 19:39:52 +0000 (UTC) Injection-Info: dont-email.me; logging-data="265289"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX186uvCuqhx32BrLkno5XD9r4QU7FGxntas="; posting-host="bd1e3914c303cfcd1607cc3629384ba7" 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:BWwy0Ilovn8cb2qOlw1XWkfeN48= sha256:99bN0tFrbkXq5B29Au1zFJV8dzoMujoNnLkbylSZik8= sha1:yYInJyanVkFXcZm+zophyJBgcNs= sha256:LytFNmQDrtorpAyfXrqJIdJdL/6OhtvzEgJbaRACoWA= In-Reply-To: <11d53si$7o8t$1@dont-email.me>