Ended up specifying array size as per Simon's suggestion:

#[link_section=".isr_vector_temp"]
#[no_mangle]
pub static ISRVectors: [extern unsafe fn(), ..4] = [
  _stack_base,
  main,
  isr_nmi,
  isr_hardfault,
];

Given that table size is an architecture-dependent time constant, it also
adds a tiny bit of verification that all ISRs are defined.

Also tried defining something along the lines of *[extern unsafe fn()], but
I guess size is also required in this case.

Thanks all!



On Sat, Apr 5, 2014 at 12:00 PM, Corey Richardson <co...@octayn.net> wrote:

> A C-style array is written `*T`, much like in C (note: I'm not saying
> `T*` and `T[]` are the same type, I know they aren't)
>
> On Sat, Apr 5, 2014 at 6:53 AM, Simon Sapin <simon.sa...@exyr.org> wrote:
> > On 05/04/2014 11:39, Vladimir Pouzanov wrote:
> >>
> >> The problem is that &[extern unsafe fn()] results in 8 bytes, pointer to
> >> the actual array and its size. Is there any way I can get a plain
> >> C-style array in rust?
> >
> >
> > If the size is known as compile-time you can use:
> >
> > static table: [extern unsafe fn(), ..2] = [foo, bar];
> >
> > --
> > Simon Sapin
> >
> > _______________________________________________
> > Rust-dev mailing list
> > Rust-dev@mozilla.org
> > https://mail.mozilla.org/listinfo/rust-dev
>
>
>
> --
> http://octayn.net/
> _______________________________________________
> Rust-dev mailing list
> Rust-dev@mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>



-- 
Sincerely,
Vladimir "Farcaller" Pouzanov
http://farcaller.net/
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to