Inversion of control or dependency injection - anyone who does this in C?

See for example here

https://stackoverflow.com/questions/139299/difference-between-dependency-injection-di-inversion-of-control-ioc

to remind myself what IoC and DI are.

Question and answer here

Is control inversion specific to OO languages?

assumes no OO language is required for it.

Now, my question is: does anyone do this in C?

I ask because we are writing inline C and are considering applying these methods without changing our programming language.

+3
source share
2 answers

Doing this in C all the time. The hint is given in the answer from Azder in your second link:

" Windows API , ."

qsort() bsearch().

+2

COM, - . DLL. DLL, , (UUID) DLL, . , QueryInterface(), COM DLL , .

IoC COM. COM "C", , , . , DLL. Catia ( Dassault Systemes) CNext (V5/V6). Framework Model Modeler.

:

  • ,
  • DLL, .
  • DLL # 2
  • DLL
  • , DLL, , , ( ) : IDoSomething Get_IDoSomething(). , , , .
  • , # 5. , DLL, # 3

.

0

Source: https://habr.com/ru/post/1724371/


All Articles