GTK / C
-
- Enthusiast
- Posts: 133
- Joined: Sun Apr 01, 2018 11:26 am
GTK / C
I am learning C. I understand that C can only produce output in the terminal. For graphics and GUI the GTK library can be used. GTK is entirely written in C, but how is that possible, if C can only produce text? Or did they use inline assembler for this?
Re: GTK / C
No. C is a syntax. Basically, you have a syntax which contains maths and logic operations.
Then, if you want to exchange datas through a GUI, you must include the respective library.
Library is a set of functions which create and modify several objects, including graphic interface objects.
If you do not use them, you must all build pixel after pixel. What it is the hardest is not build everything, but use rightly the hardware, what is too different from one computer to another one.
Libraries are not just an single block : you have many levels, and the lowest are dealt by the manufacturer. The highest libraries allow you to display an object without knowing the hardware specifications (there are a lot).
Then, if you want to exchange datas through a GUI, you must include the respective library.
Library is a set of functions which create and modify several objects, including graphic interface objects.
If you do not use them, you must all build pixel after pixel. What it is the hardest is not build everything, but use rightly the hardware, what is too different from one computer to another one.
Libraries are not just an single block : you have many levels, and the lowest are dealt by the manufacturer. The highest libraries allow you to display an object without knowing the hardware specifications (there are a lot).
Re: GTK / C
You should just take a look into simple C source code examples which display just an empty window or a window with just a "Hello World" button using the GTK3 framework. Below the source codes you find the command line to compile the source code. There you instruct the GCC compiler to use GTK3 to resolve the API calls which do the window and gadget drawings.