How Do I ......????

Ben Duncan ben
Thu Sep 9 18:59:44 PDT 2004


Ok, I am writing a system that contains several modules.

The header for the system has a declaration for a function defined
as :

int OpenWindow( int row, int col, int rowsize, int colsize, const char *title)

row, col, rowsize, colsize are USED thru out all the modules.

I have one program called slag-module.c, that forms the library core
and calls all other modules compiled in. Some of the modules are
called : grid.c, button.c, form.c, checkbox.c, ..etc..etc..

So, I have a compile statement that looks like thus:
------------------------------------------------------
for file in `ls src/*.c`
do
  OBJ=`basename $file ".c"`
  echo "Now creating file $OBJ from $file "
  cc -c -O2 -fno-strength-reduce " objdir/${OBJ}.o \
    -I./include -I/usr/include/slang \
        -fwritable-strings \
        src/${OBJ}.c
done

echo "Now creating the .so module"
cc -c -02 -fno-strength-reduce  -shared -fPIC \
   -I./include -I/usr/include/slang src/slag-module.c  \
        objdir/*.o \
        -o objdir/slag-module.so \
        -L/usr/lib -lslang -ldl -lm
--------------------------------------------------------

In the slag-module.c is the actual OpenWindow function, and
in several of the c program modules they call
   OpenWindow( 'int row', 'int col', 'int rowsize', 'int colsize',  "String of data")


What I would like to do is set up some sort of GLOBAL variable, so that the
modules that are using "OpenWindow" would do it this way:

gl_row = 'int row' ;
gl_col = 'int col' ;
gl_rowsize = 'int rowsize' ;
gl_colsize = 'int colzise' ;

OpenWindow( "string of data")

An where "gl_xxxxx" is modifiable from any modules, they are
defined JUST in one place.

So, how do I set this up do to this ?

Thanks ...





-- 
Ben Duncan   - VersAccounting Software LLC 336 Elton Road  Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
        - Hanlon's Razor



More information about the Linux-users mailing list