c and assembly problem
Posted: Wed Jan 25, 2012 3:40 pm
I write my os mostly in c, but sometimes I NEED to use assembly. if i define a variable in c:
and then i want to do something with it in assembly:
the gcc compiler gives me this error:
why?
Code: Select all
main()
{
long var = 0;
}
Code: Select all
asm("movl $1, var\n");
Code: Select all
/tmp/ccpKcN36.o: In function `main':
test.c:(.text+0xf): undefined reference to `var'
collect2: ld returned 1 exit status