|
From: Robert W. <rwi...@sh...> - 2003-04-26 05:10:20
|
---- Original Message -----
From: "Oscar Fuentes" <of...@wa...>
To: <min...@li...>
Cc: <rwi...@sh...>
Sent: Friday, April 25, 2003 9:35 PM
Subject: Re: [Mingw-users] Assembly language
> Robert Wishlaw <rwi...@sh...> writes:
>
> > I am trying to port this snippet from the LCCWin32 compiler to MinGW32.
> >
> > for (register int i=nArgs-1;i >=0; i--)
> > {
> > arg = argtable[i];
> > asm("pushl %arg");
> > }
> >
> > The inline assembly asm("pushl %arg"); is causing an error
> > s137.o(.text+0x53d):s137.c: undefined reference to `arg'
> >
> > Can someone please tell me what the correct syntax is for the
> > assembly statement?
>
> http://gcc.gnu.org/onlinedocs/gcc-3.2.2/gcc/Extended-Asm.html
Thank you for this reference. It is exactly what I needed.
>
> An example:
>
> int main() {
> int in = 10;
> int out = 0;
> asm("pushl %0" : : "r" (in));
> asm("popl %0" : "=r" (out) : );
> printf("%d\n", out);
> }
>
> HTH
A great simple example.
Andy Ross sent me this
asm("pushl %0" : : "r" (arg));
You must be reading the same books.
Thank you again for your help.
Robert Wishlaw
|