www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/25/18:36:59

Sender: nate AT cartsys DOT com
Message-ID: <3592CB4F.1419C970@cartsys.com>
Date: Thu, 25 Jun 1998 15:12:31 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
MIME-Version: 1.0
To: oonly AT mailexcite DOT com
CC: djgpp AT delorie DOT com
Subject: Re: djgpp assmebly question
References: <359298DF DOT 17A1 AT mailexcite DOT com>

Bob Berkawitz wrote:
> 
> I can't get this code to work.  I compile it with this command:
>         gcc file.c -o file.exe
> I get this error:
>         file.c:6: invalid 'asm': operand number missing after %-letter
> 
> Here is the code.
> void main()
> {
>         asm("movl $0, %ecx"
>         :/*no input*/
>         :/*no output*/
>         :"%ecx");
> }
> 
> Line six is the line that says:
>         :"%ecx");
> Thanks in advance

Remove the `%' sign in the clobber list; it's not needed there.  (Only
the assembler needs it, and the assembler never sees the clobber list.)

You may also need to double the `%' in the actual asm statement, since
GCC uses that for operand constraints normally.

And, `main' should return `int'.
-- 

Nate Eldredge
nate AT cartsys DOT com


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019