I tried to explain this in my reply in the Futhark issue, but I was on my way to the airport so the answer was a bit brief. What you're seeing in `AV_CHANNEL_LAYOUT_MASK` is an object constructor, however since C doesn't have typed macros it doesn't tell us which object its constructing for. The following `define` statements then expand this snippet of text and replaces `nb`, and `m` in the template with the given arguments. We still don't have any type information as these are only text expansions. Whenever you try to use e.g. `AV_CHANNEL_LAYOUT_STEREO` it will then simply paste in this object constructor, and if you are using it correctly this will be a place where such an object constructor is allowed and it will create an object of whatever type was required. Since Nim has fully typed macros and not just text expansion this isn't really something you could easily do in Nim. However by looking at the surrounding code (and comments), we are able to grok what this is actually supposed to be doing and can create a template a bit something like this: template AV_CHANNEL_LAYOUT_MASK(nb, m: untyped): AVChannelLayout = AVChannelLayout(order: AV_CHANNEL_ORDER_NATIVE, nb_channels: nb, u: AVChannelLayoutAnonUnion(mask: m), opaque: nil) Run
This will create an object of kind `AVChannelLayout` which can then be used just like the ones in the C code. The name of `AVChannelLayoutAnonUnion` might of course vary, I don't remember exactly what Futhark generates in this case, but it's something similar to that.