This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++ 3 name mangling
On Mon, Mar 04, 2002 at 06:04:35PM +0100, jeroen dobbelaere wrote:
> > void Foo::f(int i) { ... }
> >
> > extern "C" void stub_Foo_f(Foo* th, int i);
> > inline void stub_Foo_f(Foo* th, int i) { th->f(i); }
> >
> > and then use stub_Foo_f in the __asm__.
>
> Problem is that I don't have control over the calling side : the c++ interface is
> fixed. The implementation has to do some very low level things.
I didn't say you need to change the C++ interface,
just write a wrapper for it. If you can write:
__asm__ {
...
..._ZXYZ...
}
then you can also write:
extern "C" void stub(Foo* th);
inline void stub(Foo* th) { th->XYZ(); }
__asm__ {
...
...stub...
}
Imho this is the cleanest solution: the compiler will do
the mangling for you. Optimization will remove the "C" function,
your asm will still call the C++ function directly.
--
Carlo Wood <carlo@alinoe.com>