Problems Compiling With GLib...

Status
Not open for further replies.

reaperhulk

Ars Tribunus Militum
1,916
I've been working on porting some linux code over to Darwin for a day now and while I've worked past most of the big problems (no MSG_NOSIGNAL in Darwin!) I am running into a massive compile error on a function defined in glib.h and I cannot figure out why it is a problem. The function in question is G_LOCK_DEFINE_STATIC();. In the code G_LOCK_DEFINE_STATIC(stdout); is called, but when gcc gets to it it spits out these kinds of errors:

warning: cannot merge ) with _lock, result is not a valid token
syntax error, found '&'
illegal external declaration, missing ';' after ']'
illegal method selector, found '86'
illegal method definiton, missing '{' after '0'

Here's a code snippet to show context...
code:<HR>
Code:
/* this mutex provides a lock for stdout to avoid display conflict between thread */
G_LOCK_DEFINE_STATIC(stdout);<P>static FILE *log_fd=NULL;
static FILE *errlog_fd=NULL;<P>/* this is the list of strings prefixed to displayed messaged */
/* always 5 bytes + a ] at the end. They must be in the same */
/* order as in DISP_MSG_TYPE */
static const char *msg_str_type[]={
										"ERR  ]",
                              "DEBUG]",
                              "INFO ]",
                              "USER ]",
                              "OP   ]",
                              "USER+]",
                              "USER-]",
                              "CHAT ]",
                              "UINFO]",
                              "HUBNM]",
                              "SREST]",
                              "$USER]",
                              "$UL+ ]",
                              "$UL- ]",
                              "$UL# ]",
                              "$DL+ ]",
                              "$DL- ]",
                              "$DL# ]",
                              "HUB- ]",
                              "PRIV ]",
                              "XFERR]",
                              "XFERQ]",
										"HUBGO]",
                              "$DL~ ]",
										"CMDKB]",
                              "HUB+ ]",
                              "$LS+ ]",
                              "$LS- ]",
                              "$LS# ]",
										"FLST ]",
										"FLSTE]",
                              "$UL= ]",
                              "$DL= ]",
                              "$LS= ]",
                              "$LS~ ]",
										"ASTRT]",
										"ASTOP]",
										"RFRSH]",
										"BXFER]",
										"VAR  ]",
										"EXFER]",
										"PASWD]",
										"ADMIN]",
                              "$ULST]",
										"PRGBR]",
										"GQLSB]",
										"GQLSC]",
										"GQLSE]",
										"GLSTB]",
										"GLSTC]",
										"GLSTE]",
										"UALSB]",
										"UALSC]",
										"UALSE]",
										"UALS+]",
										"UALS-]",
                              };<P>#define ERR_TO_LOG(x)	if((errlog_fd!=NULL)&&(msg_type==ERR_MSG))	{x;}
 
Status
Not open for further replies.