This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g++ 3 name mangling


Carlo Wood wrote:

> On Mon, Mar 04, 2002 at 06:04:35PM +0100, jeroen dobbelaere wrote:
> 

[..]


>>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.
> 
> 
Yes, but in my case, I need to fill in the body of the c++ method

with some assembler code that jumps to a generic part without tampering
the stack and basic registers.
Embedding the assembler inside the c++ method could work
if you are sure that no function prologue/epilogue is created.
(which is the case for this specific target with gcc-3.0.4), but this
is not guaranteed to work. So, a more basic solution was needed.

Greetings.
--
Jeroen Dobbelaere
Embedded Software Engineer

ACUNIA Embedded Solutions
http://www.acunia.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]