delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/03/02:57:47

Date: Mon, 3 May 1999 09:54:20 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Radu Georgescu aka skoola <skoola AT go DOT ro>
cc: djgpp AT delorie DOT com
Subject: Re: asm
In-Reply-To: <372CBF1D.891D92CD@go.ro>
Message-ID: <Pine.SUN.3.91.990503095356.4057I-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 3 May 1999, Radu Georgescu aka skoola wrote:

> when optimizing my program, the compiler modifies my asm statements and
> the program crashes.
> 1) what should i do to make gcc not to optimize my source

You need to tell the compiler which registers your inline assembly
clobbers, as part of the inline assembly code.  See the section
"Extended Asm" in the GCC docs, by typing this from the DOS prompt:

	info gcc "c extensions" "extended asm"

(Note the quotes: they are important.)

> 2) how can i compile my sources as libraries?

See section 8.22 of the FAQ.  However, I believe you won't need this
once you tell the compiler which registers are clobbered.

> 3) how can i use constant values in my asm statement (like those
> declared with define; note that the asm statement is a sting, therefore
> define wont work)

The ## operator can be used to concatenate #define'd macros, and the #
operator can be used to stringify a macro argument.  See the
pre-processor docs for more details, by typing these lines from the
DOS prompt:

	info cpp macros stringification
	info cpp macros concatenation

- Raw text -


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