langref: add docs for @extern

This commit is contained in:
Andrew Kelley 2021-04-22 16:24:14 -07:00
parent 6cd71931cb
commit 41efdc73b9

View File

@ -7517,13 +7517,13 @@ test "main" {
{#header_close#} {#header_close#}
{#header_open|@export#} {#header_open|@export#}
<pre>{#syntax#}@export(target: anytype, comptime options: std.builtin.ExportOptions) void{#endsyntax#}</pre> <pre>{#syntax#}@export(identifier, comptime options: std.builtin.ExportOptions) void{#endsyntax#}</pre>
<p> <p>
Creates a symbol in the output object file. Creates a symbol in the output object file.
</p> </p>
<p> <p>
This function can be called from a {#link|comptime#} block to conditionally export symbols. This function can be called from a {#link|comptime#} block to conditionally export symbols.
When {#syntax#}target{#endsyntax#} is a function with the C calling convention and When {#syntax#}identifier{#endsyntax#} is a function with the C calling convention and
{#syntax#}options.linkage{#endsyntax#} is {#syntax#}Strong{#endsyntax#}, this is equivalent to {#syntax#}options.linkage{#endsyntax#} is {#syntax#}Strong{#endsyntax#}, this is equivalent to
the {#syntax#}export{#endsyntax#} keyword used on a function: the {#syntax#}export{#endsyntax#} keyword used on a function:
</p> </p>
@ -7550,6 +7550,14 @@ export fn @"A function name that is a complete sentence."() void {}
{#see_also|Exporting a C Library#} {#see_also|Exporting a C Library#}
{#header_close#} {#header_close#}
{#header_open|@extern#}
<pre>{#syntax#}@extern(T: type, comptime options: std.builtin.ExternOptions) *T{#endsyntax#}</pre>
<p>
Creates a reference to an external symbol in the output object file.
</p>
{#see_also|@export#}
{#header_close#}
{#header_open|@fence#} {#header_open|@fence#}
<pre>{#syntax#}@fence(order: AtomicOrder){#endsyntax#}</pre> <pre>{#syntax#}@fence(order: AtomicOrder){#endsyntax#}</pre>
<p> <p>