www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/16/19:39:12

From: Leath Muller <leathm AT gbrmpa DOT gov DOT au>
Message-Id: <199606162318.JAA03475@gbrmpa.gov.au>
Subject: Referencing C var's in inline asm
To: djgpp AT delorie DOT com
Date: Mon, 17 Jun 1996 09:18:14 +1000 (EST)

I am trying to write some assembly routines, and I want to do them inline, so
I can pretty much mix the C and asm a lot...how do I access C vars in a
subroutine from within the asm code?
eg:
	void foo(int a, int b...)
	{
		static int fred = a;

		_asm_ __voloatile__ ("
			movl	_fred, %eax;
			...
		")
	printf("%bd\n",fred);
	}

This isnt the actual code, but demonstrates what I basically want to do. The
compiler keeps telling me that I have an undefined reference to 'fred'.

I cant imagine this being a really hard problem to fix... :) I also want to
do things this way cause I have a lot of variables, and dont want to be
continually passing stuff in and out in registers with : : stuff at the
end of the statements...any clues?

Leathal.

- Raw text -


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