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

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


Hi,

> >         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..
>
> I believe this should work just fine. So long as it can find the void
> function itself (meaning the namespace can add proper mangling around
> it, provided "it" can be found in the first place).

	Well.... If it's a C style name and the extern "imports" it to the
namespace, everything seems like it would be fine.  Unfortunately I don't
think that's what would happen.  Unfortunately I don't believe that it would
make "something::function" resolve correctly the the C implementation.  I
don't even think that it would make something::function resolve at all
within external references..

> As for particular
> registers and such that have to be preserved or restored, I
> don't think
> *that* part changes with version of g++, I think that 2.91 of
> redhat 6.2
> and 2.96 of RH 7.x, or even g++ versions 3.x+ should all have the same
> requirements on registers to save and restore. Someone here no doubt
> knows more about this and can verify it, only mangling schemes should
> change between those versions. I definitely need someone at BLUG that
> can say this is right or wrong.

	Registers don't really matter..  I can always have a GCC version of the
function which saves *everything* including CPU processor flags if required.
Register knowledge is only required for optimization, you can always just
save everything if you don't know....  (Obviously it would be a waste, but
it *would* work.)

	Regards,

	KB




More information about the LUG mailing list