[kaffe] accessing a variable
Dalibor Topic
robilad@kaffe.org
Sat Jan 10 12:00:03 2004
Hi Ram,
kalyan ram wrote:
> Hai
> I started a thread in thread.c file which is
> running a tcp client(this is working fine on kaffe).In
> that thread,I am having a data structure(like an
> array).But for simplicity,I am using a small integer
> variable.I need to be able to access that variable
> from kaffe.def file which is part of
> intrp/machine.c(interpreter version of kaffe).I put a
> variable in thread.h (because it is included in
> machine.c file)and tried to print that variable in
> kaffe.def.But when I "make",kaffe says "multiple
> definition" or sometimes "unrecognized".Is there is
> any workaround for that?How to make a variable in
> thread.c be recognized in kaffe.def?
> Any insights will be appreciated!
You need to put a declaration of the variable in thread.h and include
thread.h in machine.c. Note that a declaration is not the same as a
definition!
So basically, put
extern someType myVar;
in thread.h, and
#include "thread.h"
in machine.c
cheers,
dalibor topic