Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

__attribute__ ?

Status
Not open for further replies.

asrock70

Full Member level 4
Joined
Oct 9, 2010
Messages
201
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,298
Activity points
3,252
Can someone explain the code in C ++ for gcc

Code:
extern "C" void ADC1_COMP_IRQHandler (void) __attribute__((alias("_ZN6AdcIrq3IrqEv")));

Meaning I understand, instead of the default interrupt handler ADC1_COMP_IRQHandler calls its own function void AdcIrq::Irq (void) .
What I probably don't understand the most is "_ZN6AdcIrq3IrqEv"

Second question.
How is the same thing written in C MDKARM or c IAR (not support __attribute__ ) ?

Thanks for explaining.
 

Refer to gcc manual
alias ("target")
The alias attribute causes the declaration to be emitted as an alias for another
symbol, which must be specified. For instance,
void __f () { /* Do something. */; }
void f () __attribute__ ((weak, alias ("__f")));
defines ‘f’ to be a weak alias for ‘__f’. In C++, the mangled name for the target
must be used. It is an error if ‘__f’ is not defined in the same translation unit.
Not all target machines support this attribute.

The cryptic function name will be probably found in a target specific library. If no alias construct is supported by your tool chain, you can surely reference the function directly.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top