Creating a microcontroller startup file

Mike via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Apr 8 15:48:25 PDT 2015


On Wednesday, 8 April 2015 at 15:44:00 UTC, Jens Bauer wrote:
> On Wednesday, 8 April 2015 at 11:17:12 UTC, Mike wrote:
>> I did something along these lines (modified to match your 
>> example) and it worked fine for me:
>>
>> alias VectorFunc = void function();
>>
>> @attribute("weak") @attribute("alias", "defaultHandler")
>> extern void Reset_Handler();
>
> Strange; I can't get it to build without extern(C).
> Also, if I remove extern(C) from for instance 
> HardFault_Handler, then a HardFault_Handler written in C is not 
> found by the linker.

If HardFault_Handler is written in C then you will definitely 
need to decorate with extern(C).

If your handlers are written in D, and neither the implementation 
nor the declaration are decorated with extern(C) then it should 
work.

Mike


More information about the Digitalmars-d-learn mailing list