[lug] C++ inline asm on g++
Kelly Brock
krbrock at pacbell.net
Thu Jan 10 18:33:26 MST 2002
Hi,
> > The reason that this came up is not because using
> the inline assembly is a
> > problem, it's because I can't figure out how to turn off
> the prolog and
> > epilog code for the function in question. I need the
> function to do it's
> > own stack manipulation because it's a rather exotic little
> thing. In VC I
> > do this quite simply with the following:
>
> By turning off prolog and epilog, is this therefore a question of the
> calling convention being done manually? Or is the prolog and
> epilog not
> part of the calling convention, e.g., not part of who cleans
> up or what
> order arguments are placed on the call stack? I have a feeling the
> prolog and epilog are something different than calling convention, but
> closely related.
They are very closely related but since it's a void/void function that's
really not a major issue. In the particular function, because it's
expecting a specific stack layout at the time it's called in order to do
it's work, the prolog/epilog code will cause problems. I can probably work
around this but it's a lot more prone to be buggy since the prolog/epilog
code could change from compiler to compiler and if it's anything like VC, it
can/does change between debug and release. The 'naked' ability in VC allows
me to avoid such issues.
Anyway, this is not an insurmountable problem even if I have to use a "C"
version of the function. It's just a lot cleaner the VC way and it would be
really nice to be able to do maintain the code as similiar on both platforms
as possible.
Just a thought, what would happen with the following?
namespace something
{
extern void function(void);
};
Is name mangling still an issue and/or will the function be imported into
the namespace? Hmm, don't think I've ever tried this one, I'll dig out the
bible and see..
Regards,
Kelly Brock
The Sims Online
Maxis - Electronic Arts
More information about the LUG
mailing list