Fixed Length Array Syntax in extern(C) Function Signatures

Timon Gehr via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 9 09:12:26 PDT 2015


On 07/09/2015 05:19 PM, "Nordlöw" wrote:
> Given
>
>      extern(C):
>
>      struct AVFrame
>      {
>          uint8_t*[AV_NUM_DATA_POINTERS] data;
>          int[AV_NUM_DATA_POINTERS] linesize;
>          int width, height;
>          ...
>      }
>
>      void av_image_copy(ubyte *[4] dst_data, int[4] dst_linesizes,
>                         const ubyte *[4] src_data, const int[4]
> src_linesizes,
>                         AVPixelFormat pix_fmt, int width, int height)
>
>
> will `dst_data` will be C-ABI-fed to `image_copy()` as a C-style single
> pointer in constrast to what happens in D which calls it as fixed-size
> (4) array of ubyte-pointers?

No. You'll need explicit pass by reference on the D side.


More information about the Digitalmars-d-learn mailing list