Date: Sat, 22 Jul 95 21:44 MDT From: mat AT ardi DOT com (Mat Hostetter) To: ld AT netrix DOT com Cc: Roberto Alsina , djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: Inline assembler Newsgroups: comp.os.msdos.djgpp References: >>>>> "Long" == Long Doan writes: Long> |> 2) How do i reference a local variable (or label) or an Long> argument passed to a |> function from an asm? _varname only Long> seems to work with globals. Long> You'll have to look at their orders (some might be optimized Long> away!), and the offset them from %ebp. This is _extremely_ bad advice, especially for local variables! I can't believe you're suggesting it. Use gcc's asm operands to specify input and output values, e.g. void foo (int a) { int x; asm ("movl %1,%0" : "=r" (x) /* Outputs */ : "g" (a) /* Inputs */); printf ("%d\n", x); } This is all explained in the gcc docs. -Mat