C-binding external array.

ciechowoj via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 9 07:09:12 PDT 2016


On Tuesday, 9 August 2016 at 14:01:17 UTC, Steven Schveighoffer 
wrote:
>
> I think this should work:
>
> extern extern(C) int[1] tab;
>
> Then if you want to access the elements, use the tab.ptr[elem]
>
> If it's a global variable, tack on __gshared.
>
> -Steve

I've already tried this and works (64-bit at least on linux). But 
is it portable?

No other way that allow to access the `tab` directly (without 
.ptr proxy) ?


More information about the Digitalmars-d-learn mailing list