delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/11/19:55:32

Date: Sat, 11 Oct 1997 16:53:14 -0700 (PDT)
Message-Id: <199710112353.QAA25412@adit.ap.net>
Mime-Version: 1.0
To: "Newbie" <new AT no_spam DOT com>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Why can't I refer to local variables in in-line assembly?

At 12:27  10/10/1997 GMT, Newbie wrote:
>I just found out I can't make reference to any local variable using in-line
>assembler with Rhide 1.4.
>Is this a restriction of Rhide per say, or it's universal for all DJGPP
>compilers.
>Is there any way around this shorting of changing those variables to glabal?
It is universal for all compilers. You can use GCC's inline asm constraints,
see `info gcc "C Extensions" "Extended Asm"'. These will give you the
address of the variable. For instance:

int add_four(int x)
{
asm("addl $4,%0" : "=g" (x) : "g" (x));
return x;
}



Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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