diff --git a/doc/langref.html.in b/doc/langref.html.in index 29e1105e280902685e7b184284bcf72a0e98e2f3..acf621c33f465f96477465c5d6b23c6032eaccaf 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -6215,6 +6215,35 @@ test "main" {
Creates a symbol in the output object file.
++ 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 + {#syntax#}linkage{#endsyntax#} is {#syntax#}Strong{#endsyntax#}, this is equivalent to + the {#syntax#}export{#endsyntax#} keyword used on a function: +
+ {#code_begin|obj#} +const builtin = @import("builtin"); + +comptime { + @export("foo", internalName, builtin.GlobalLinkage.Strong); +} + +extern fn internalName() void {} + {#code_end#} +This is equivalent to:
+ {#code_begin|obj#} +export fn foo() void {} + {#code_end#} +Note that even when using {#syntax#}export{#endsyntax#}, {#syntax#}@"foo"{#endsyntax#} syntax can + be used to choose any string for the symbol name:
+ {#code_begin|obj#} +export fn @"A function name that is a complete sentence."() void {} + {#code_end#} ++ When looking at the resulting object, you can see the symbol is used verbatim: +
+00000000000001f0 T A function name that is a complete sentence.+ {#see_also|Exporting a C Library#} {#header_close#} {#header_open|@fence#} @@ -8074,6 +8103,7 @@ pub fn build(b: *Builder) void { $ ./test $ echo $? 0 + {#see_also|export#} {#header_close#} {#header_open|Mixing Object Files#}