GTK / C

For everything that's not in any way related to PureBasic. General chat etc...
Martin Verlaan
Enthusiast
Enthusiast
Posts: 126
Joined: Sun Apr 01, 2018 11:26 am

GTK / C

Post by Martin Verlaan »

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?
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

Re: GTK / C

Post by Olliv »

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).
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: GTK / C

Post by Shardik »

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.
Post Reply