On Sunday, 6 January 2013 at 10:21:56 UTC, bearophile wrote:
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

Thank you for your reply.

I cannot find "cint_t" nor "cint" in the d standard modules (mine are at /usr/include/d/).

For the symbol "*", do you mean I should write something like this?
uint8_t[4]* ptrs

- Minh

Reply via email to