DEV Community

Discussion on: The different files of C

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

Practically, I don't understand why webview.h, not webview.c.

Also, I wrote cgo, but I seemed to write functions that where copied from webview.h? Also, it is indeed possible to reference webview-custom.h externally.

Collapse
 
konstantinklima profile image
Konstantin Klima

These are called header only libraries.
The idea is portability primarily - you don't drag along C files which you have to compile and keep track of (by using make and linking them separately). The compiler does copy all the code into the .o file made from your .c that included the .h and that is the down side.