Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
37 user(s) are online (23 user(s) are browsing Forums)

Members: 1
Guests: 36

Nuder_Try, more...

Support us!

Headlines

Report message:*
 

Re: gcc 9 and 10

Subject: Re: gcc 9 and 10
by billyfish on 2021/4/19 15:08:46

If you have a globals header file you can have something like

#ifndef DOXYGEN_SHOULD_SKIP_THIS

#ifdef ALLOCATE_GLOBALS
    #define GLOBAL_PREFIX 
    #define GLOBAL_VAL(x)    = x
#else
    #define GLOBAL_PREFIX extern
    #define GLOBAL_VAL(x)
#endif

#endif         /* #ifndef DOXYGEN_SHOULD_SKIP_THIS */

GLOBAL_PREFIX const char *G_NAME_S GLOBAL_VAL ("name");
GLOBAL_PREFIX int g_log_level GLOBAL_VAL (1);



then in one of the c source files have

#define ALLOCATE_GLOBALS (1)


before the

#include "globals.h"

line in that particular file and it will define and declare the variables just fine


Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project