On 19 Apr 2014 01:35, "Mike via D.gnu" <d.gnu@puremagic.com> wrote:
>
> Hello,
>
> It is common practice in ARM Cortex-M bare metal C/C++ programs to define symbols in the linker so one can initialize the .data and .bss segments and know the boundaries of one's stack and heap.  It looks something like this.
>
> **** linkerscript ****
> __text_end__ = .;
>
> .data : AT(__text_end__)
> {
>     __data_start__ = .;
>     *(.data)
>     *(.data.*)
>     __data_end__ = .;
> } > SRAM
>
> **** C++ file ****
> extern "C" uint32_t __text_end__;
> extern "C" uint32_t __data_start__;
> extern "C" uint32_t __data_end__;
>
> void startup()
> {
>     // copy mutable state out of ROM into RAM
>     memcpy(&__data_start__, &__text_end__, (&__data_end__ - &__data_start__) * 4);
> }
>
> I tried to do something similar in D with...
>
> extern(C) __gshared uint __text_end__;
> extern(C) __gshared uint __data_start__;
> extern(C) __gshared uint __data_end__;
>
> ... but unfortunately this puts new variables in the .bss segment.  I want the un-mangled name, so I can refer to it easily, but I also want it to be truly "extern" (defined elsewhere).  Is that possible at this moment in D?
>
> Thanks for the help,
> Mike

I think you mean to 'extern (C) extern'

Iain