Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How are low-level libraries made?

When I go and make a C++ application I generally use libraries like SDL or WxWidgets and so on. But if I were to make a library would I need to use a library to make a library? Or can I make the entire library out of core C++ code, is this even possible?

My point is that there must be a point were a library has nothing to base itself on and so the only things it can use are core C++.

Am I right with this theory? If not, how are low-level libraries really made?

(I know this is a broad question, but I am a very curious person that needs answers and this is something that has bothered me.)

like image 758
DavidColson Avatar asked May 27 '12 10:05

DavidColson


1 Answers

Low level libraries access hardware and system resources through libraries provided by the operating system. The operating system itself and the drivers loaded by it use assembly and reads/writes of predefined memory addresses to modify CPU state and communicate with hardware.

A library that only depends on C++ can only be a utility library as any communication with the hardware or user would involve either assembly or an additional library. An example for a pure C++ library without dependencies would be a math library, as it doesn't require I/O or hardware access.

like image 191
josefx Avatar answered Sep 20 '22 17:09

josefx