added documentation for field access to C pointers (#3088)
This commit is contained in:
parent
d067a037cc
commit
efc2237e5a
@ -9322,6 +9322,13 @@ const c = @cImport({
|
|||||||
<li>Does not support Zig-only pointer attributes such as alignment. Use normal {#link|Pointers#}
|
<li>Does not support Zig-only pointer attributes such as alignment. Use normal {#link|Pointers#}
|
||||||
please!</li>
|
please!</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<p>When a C pointer is pointing to a single struct (not an array), deference the C pointer to
|
||||||
|
access to the struct's fields or member data. That syntax looks like
|
||||||
|
this: </p>
|
||||||
|
<p>{#syntax#}ptr_to_struct.*.struct_member{#endsyntax#}</p>
|
||||||
|
<p>This is comparable to doing {#syntax#}->{#endsyntax#} in C.</p>
|
||||||
|
<p> When a C pointer is pointing to an array of structs, the syntax reverts to this:</p>
|
||||||
|
<p>{#syntax#}ptr_to_struct_array[index].struct_member{#endsyntax#}</p>
|
||||||
{#header_close#}
|
{#header_close#}
|
||||||
|
|
||||||
{#header_open|Exporting a C Library#}
|
{#header_open|Exporting a C Library#}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user