Placing variable/array in a particular section

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 3 06:37:50 PDT 2015


On 4/04/2015 2:12 a.m., Jens Bauer wrote:
> Today I finally succeeded in building my first "Hello World" D program
> (after fixing the endian problem).
>
> Is there a way of setting the target section for a variable or an array ?
>
> Eg. the equivalent way of doing this using gcc is:
>
> __attribute__((section(".isr_vector"))) VectorFunc g_pfnVectors[] = {
> ... };
>
> -I need this functionality, because on microcontrollers, it's necessary
> to control where in RAM / flash memory the data is written.
>
> I could of course do this using C or assembly language, but I'd like to
> use pure D only, if possible.

Supposedly gdc supports it.

[0] http://wiki.dlang.org/GDC/Using_GDC Extensions->Attributes
[1] 
https://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html#Variable-Attributes


More information about the Digitalmars-d-learn mailing list