Global variables just disappear after initialization.
Posted: Thu Aug 09, 2007 7:46 am
Hi, everyone
Right now i just cannot use those global variables as soon as it's initialized in global.c.
The example is as follows:
This is global.c
----------------------------------------------------------------------------------
char a[3]={1,2,3};
struct task_s task_table[3] = {{process0, 0x8000, "TestA"},
{process1, 0x8000, "TestB"},{process2, 0x8000, "TestC"}};
-------------------------------------------------------------------------------------
This is global.h
-------------------------------------------------------------------------------------
extern struct task_s task_table[3];
extern char a[3];
-------------------------------------------------------------------------------------
This is main.c
-------------------------------------------------------------------------------------
int main()
{
disp_int(a[0]);
print(task_table[0].name);
.....
}
-------------------------------------------------------------------------------------
Well, after all of the files needed are linked up, the program can run but the monitor just displays "0" and blank. Thanks!
-------------------------------------------------------------------
Right now i just cannot use those global variables as soon as it's initialized in global.c.
The example is as follows:
This is global.c
----------------------------------------------------------------------------------
char a[3]={1,2,3};
struct task_s task_table[3] = {{process0, 0x8000, "TestA"},
{process1, 0x8000, "TestB"},{process2, 0x8000, "TestC"}};
-------------------------------------------------------------------------------------
This is global.h
-------------------------------------------------------------------------------------
extern struct task_s task_table[3];
extern char a[3];
-------------------------------------------------------------------------------------
This is main.c
-------------------------------------------------------------------------------------
int main()
{
disp_int(a[0]);
print(task_table[0].name);
.....
}
-------------------------------------------------------------------------------------
Well, after all of the files needed are linked up, the program can run but the monitor just displays "0" and blank. Thanks!
-------------------------------------------------------------------