473,395 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

some doubts in glib code

hi people..
dont know if this the right forum for this doubt ... so sorry if i am
mis-posting...
i was looking at the way glib 2.10.3 does export optimization using a
list of "to be exposed" function names in a file caleed glib.symbols.
this file is used by a perl script to generate a header a .c file
( galias.h and galiasdefs.c). This files essentially enusres default
visibility for these functions (using the __attribute__((default))__
option) , while building the rest of the functions with -
fvisibility=hidden.
i have two doubt regarding this.
1in the generated header galias.h there is a syntax
#define IN_FILE(x) 1
#define IN_HEADER defined

#if IN_HEADER(__G_ARRAY_H__)
#if IN_FILE(__G_ARRAY_C__)
extern __typeof (g_array_append_vals) IA__g_array_append_vals
__attribute((visibility("hidden")));
#define g_array_append_vals IA__g_array_append_vals
....
......
#endif
#endif

whnat does #define IN_HEADER defined mean.. and how is it used
in this context.

2secondly , how does glib maintain the glib.symbols list .. is it
manual or does it use some kind of a parser to parse through the
include folder of glib to come up with the list...
hope i have been able to clearly state my doubts....
thanks in advance for the replies and help...
BR
Rahul

Jun 29 '08 #1
1 1763
On Sun, 29 Jun 2008 04:26:20 -0700 (PDT),
"ra*******************@gmail.com" <ra*******************@gmail.com>
wrote:
>hi people..
dont know if this the right forum for this doubt ... so sorry if i am
mis-posting...
i was looking at the way glib 2.10.3 does export optimization using a
list of "to be exposed" function names in a file caleed glib.symbols.
this file is used by a perl script to generate a header a .c file
( galias.h and galiasdefs.c). This files essentially enusres default
visibility for these functions (using the __attribute__((default))__
option) , while building the rest of the functions with -
fvisibility=hidden.
i have two doubt regarding this.
1in the generated header galias.h there is a syntax
#define IN_FILE(x) 1
#define IN_HEADER defined

#if IN_HEADER(__G_ARRAY_H__)
#if IN_FILE(__G_ARRAY_C__)
extern __typeof (g_array_append_vals) IA__g_array_append_vals
__attribute((visibility("hidden")));
#define g_array_append_vals IA__g_array_append_vals
...
.....
#endif
#endif

whnat does #define IN_HEADER defined mean.. and how is it used
in this context.
It tells the compiler that whenever it sees the token
IN_HEADER
it should substitute the token
defined

Consequently, the directive
#if IN_HEADER(__G_ARRAY_H__)
is processed as if it were
#if defined(__G_ARRAY_H__)

It takes some reasonably obvious syntax and obfuscates it by adding an
alias. In my opinion, this is one of those bad ideas along the lines
of
#define BEGIN {
>
2secondly , how does glib maintain the glib.symbols list .. is it
manual or does it use some kind of a parser to parse through the
include folder of glib to come up with the list...
hope i have been able to clearly state my doubts....
Ask in a glib group.
Remove del for email
Jun 29 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Arjan | last post by:
Hi, I want to open a serial port (COM1) in my Windows program (C), and I would like to use the Glib IOchannels to do this. Does anybody know how to do this? Examples maybe? Thanks in advance,...
6
by: Chua Wen Ching | last post by:
Hi there, I have some questions to ask... just say i have this xml file: Scenario :- Script.xml ======== <software> <settings>
8
by: lovecreatesbeauty | last post by:
Hello experts, I have seen following the code snippet given by Marc Boyer (with slight changes by me for a better format), and have doubts on it. I am so grateful if you can give me your kindly...
7
by: ramasubramanian.rahul | last post by:
hi i was trying to see how the compiler hides the static golbals from the linker and allows golbal varibale to be visable to the linker.i managed to figure out how it did that ( the .lcomm and...
1
by: Loic Mahe | last post by:
Hello, I would like to compile GLib as a static library on Windows XP with MinGW if possible. I downloaded GLib and needed librairies, but only the .dll files are included in the zip file. ...
1
by: lumpybanana247 | last post by:
~~~"glib.h: No such file or directory. "~~~ I am using DevC++ to compile a program and it says "glib.h: No such file or directory. " I do not have any parameters set up, but it does appear...
10
by: akappa | last post by:
Hi, I want to serialize a glib data type (an hash), but I don't want to access directly to the fields of the various structs, since it's an opaque data type: there is one "more-or-less standard...
37
by: Michael Palmer | last post by:
As anyone knows, the state of Python GUI programming is a little fractured at this time, with many toolkits, wrappers and meta-wrappers dead and alive, with or without documentation. I've come...
4
by: MN | last post by:
Hi all, I'm learning how to use some Glib-functions for simple linked list. I wrote a small program that prepends 2 data (let's say to integers "1" and "2") in list, display them, count total...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.