X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: Declaring variables in GAS Date: 8 Apr 2002 10:48:41 GMT Organization: Aachen University of Technology (RWTH) Lines: 39 Message-ID: References: NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 1018262921 701 137.226.32.75 (8 Apr 2002 10:48:41 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 8 Apr 2002 10:48:41 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Jacky Luk wrote: > This is the first time I get it-> You got it wrong. You were asking about a *global* variable and how to declare it in asm. But your C example only has a variable local to function main. Try this instead: #include int foo1 = 100; int main() { printf ("%d\n", foo1); return 0; } And the important fragments of the assembly output you'll get are: .globl foo1 .data foo1: .align 4 .long 100 And to get it into a register: movl foo1,%eax -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.