Global variables c++ (it seems a tongue twister but it's not)

Hello everyone,
I'm new in this forum, although I've been following the tutorial you have for some time, it's very useful.
I've got a (BIG for me) problem. I'm working with EURANE and ns-2 (part of it programmed in Otcl and part of it in C++) (yes, the program is the biggest problem).
I'm working with two files: am_hs.cc and hsdpalink.cc
In hsdpalink.cc a global variable is define in this way:
HsdpaMac * mac_address;
which is used in am-hs.cc as an external variable.
Also hsdpalink.cc uses rlc_address as an external variable defined in am-hs.cc

In am-hs.cc there's another global variable defined:
RLC_HS *rlc_address;
and this file uses mac_address, defined in hsdpalink.cc.

I need to make use of both global variables in two new files I've made:
am-hs1.cc and am-hs2.cc. But I also have to maintain am-hs.cc and the initial variables. How can I do it?
I've read everywhere you shouldn't use global variables, but I can't change what was done before.
Could someone please help me?

Thank you very much
Karol
global.cc

int example_global; // definition

global.h

extern int example_global; // declaration

other_file.cc (where example_global is needed)

#include "global.h"

If this doesn't help, please try to simplify and rephrase the question.
Last edited on
Thank you Catfish2. I'm going to try it. I know I didn't explain the problem very well. If it doesn't work I'll try to do it in a better way.
Thank you
Topic archived. No new replies allowed.