From: "Carolyn Kelly-Pajot" References: <345C5040 DOT 4627 AT bluewin DOT ch> Subject: Re: global variable Date: Sun, 2 Nov 1997 14:34:51 -0500 Lines: 31 Message-ID: <#T2SpX858GA.253@upnetnews03> Newsgroups: comp.os.msdos.djgpp To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk LEGER Patrick wrote in article <345C5040 DOT 4627 AT bluewin DOT ch>... >Here's a sample code : > >static int t; >... >void function(int x) >{ > asm("pusha > movw $_x,%eax > popa"); >} >After that the compiler say that "x" is unknown. >But if I load x in t as static and globale variable and put it into %eax >, the program runs. >Is there a method to use directly the argument without load them in a >globale variable ? > >thanx You can pass them as an arguement, as most people want. If you want to load it into a register, that's fine, be be sure to tell the compiler not to use that register itself or "x" will be gone. And remember that if you are using a multi-source-file program, "t" will only be known to this file. Use extern for that. Otherwise, if you want to load a variable into a register, that is your choice.