Linking with FFmpeg

bearophile bearophileHUGS at lycos.com
Sun Jan 6 02:21:55 PST 2013


MrOrdinaire:

> My question is how this function declaration is written in D.
> int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
>                    int w, int h, enum AVPixelFormat pix_fmt, 
> int align);
>
> My best guess is the following.
> extern(C) int av_image_alloc(ref uint8_t[4] *pointers, ref 
> int[4] linesizes,
>                              int w, int h, AVPixelFormat 
> pix_fmt, int align_);

D ints are 32 bit long, while the length of C ints varies across 
different architectures. So you can't use int in your D 
signature. sizediff_t is better, but I remember there is a more 
specific type for this purpose, something like cint_t, I don't 
remember.

In D the pointer symbol "*" is better (more meaningful) written 
justified on the right.

If you use a D ref, you can't put a null there.

Others will give you a better answer.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list