Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what are G_BEGIN_DECLS and G_END_DECLS for?

Tags:

gtk

glib

gtk3

I've been analyzing the code for some gtk applications and saw that in the .h files there are the G_BEGIN_DECLS and G_END_DECLS macros. The documentation says

Used (along with G_END_DECLS) to bracket header files

But I didn't understand what I meant.

like image 876
Matheus Saraiva Avatar asked Oct 19 '25 01:10

Matheus Saraiva


1 Answers

These defines should be used in the public headers of C libraries. They aren't really useful for the library itself but they may be useful to C++ applications that want to use the library as they expand to a extern "C" block which makes sure that C++ compilers are able to handle the C headers

like image 159
Jussi Kukkonen Avatar answered Oct 22 '25 05:10

Jussi Kukkonen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!