filling static vars from different file

R

r.roest

Hi,

I'm looking for a way to fill static vars from a different c-file.

Here is what I want to do:

file1.c
static DEBUG
calling function X using DEBUG to display information
calling function Y using DEBUG to display information

file2.c
static DEBUG
calling function X using DEBUG to display information
calling function Y using DEBUG to display information

main.c
load and reload ini file to set DEBUG for file1.c to true and for
file2.c to false


This is a existing system which I'm profiling to optimize the system
so I'm limited in the way of changing things. Right now the main.c
reads all ini files into a balanced tree and function X parses the
tree to check the values.

Filling static vars is just one method I'm thinking about.

Is there a way to execute a function once per source file (this could
set the var)..

Anyone have a suggestion ??

Kind regards,
Ronald
 
I

Ivanna Pee

Hi,

I'm looking for a way to fill static vars from a different c-file.

Here is what I want to do:

file1.c
static DEBUG
calling function X using DEBUG to display information
calling function Y using DEBUG to display information

file2.c
static DEBUG
calling function X using DEBUG to display information
calling function Y using DEBUG to display information

main.c
load and reload ini file to set DEBUG for file1.c to true and for
file2.c to false


This is a existing system which I'm profiling to optimize the system
so I'm limited in the way of changing things. Right now the main.c
reads all ini files into a balanced tree and function X parses the
tree to check the values.

Filling static vars is just one method I'm thinking about.

Is there a way to execute a function once per source file (this could
set the var)..

Anyone have a suggestion ??

Kind regards,
Ronald

file1.c
----------------
static int abc,foo,bar,

void initfile1vars(void)
{
abc=0xDEADBEEF;
foo=0xBEADFACE;
bar=0x69696969;
}


file2.c
----------
initfile1vars();


you could also pass in values from file1 if you like, or a pointer to
values...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top