[lug] C++ inline asm on g++

Kelly Brock krbrock at pacbell.net
Thu Jan 10 17:59:15 MST 2002


Hi,

> Kelly> Is there a variation of this usable in GCC?  I tried the
> Kelly> __attribute__ (naked) thing but couldn't get it to work.  An
> Kelly> answer to either case would be wonderful.
>
> I think __attribute__((naked)) only works on certain platforms.  If
> you want to write an assembly function with a custom prologue and
> epilogue, why not just write an assembly file?  Why use a C wrapper at
> all?

	The simple reason is that I want to maintain the encapsulation of the
function.  It's 15 lines of assembly and it's the only thing stopping an
entire set of systems from working under Linux.  If I have to move the
function all the support code will need to be changed to deal with this and
then all the referencing code will have to be changed to know that of all
the other support functions this one is now "different".

	Basically, it wouldn't be pretty but it would work.  I'd rather maintain
the pretty organization if possible though.  ;)

	Regards,

	Kelly Brock
	The Sims Online
	Maxis - Electronic Arts




More information about the LUG mailing list