authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-13 11:54:56-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-13 12:01:32-04:00
log4e40bd86336bcb5596b30d5eac9a27f9f00208f0
tree807a7b6f2df328b14b79991156674b7fa7b6a5ee
parent49838a9f3eee0df33d2994b92875314363b32dfc
signaturelock-open Commit is signed but in an unrecognized format.

add documentation for @"" syntax

closes #1614

1 files changed, 30 insertions(+), 0 deletions(-)

doc/langref.html.in+30
......@@ -6215,6 +6215,35 @@ test "main" {
62156215 <p>
62166216 Creates a symbol in the output object file.
62176217 </p>
6218 <p>
6219 This function can be called from a {#link|comptime#} block to conditionally export symbols.
6220 When {#syntax#}target{#endsyntax#} is a function with the C calling convention and
6221 {#syntax#}linkage{#endsyntax#} is {#syntax#}Strong{#endsyntax#}, this is equivalent to
6222 the {#syntax#}export{#endsyntax#} keyword used on a function:
6223 </p>
6224 {#code_begin|obj#}
6225const builtin = @import("builtin");
6226
6227comptime {
6228 @export("foo", internalName, builtin.GlobalLinkage.Strong);
6229}
6230
6231extern fn internalName() void {}
6232 {#code_end#}
6233 <p>This is equivalent to:</p>
6234 {#code_begin|obj#}
6235export fn foo() void {}
6236 {#code_end#}
6237 <p>Note that even when using {#syntax#}export{#endsyntax#}, {#syntax#}@"foo"{#endsyntax#} syntax can
6238 be used to choose any string for the symbol name:</p>
6239 {#code_begin|obj#}
6240export fn @"A function name that is a complete sentence."() void {}
6241 {#code_end#}
6242 <p>
6243 When looking at the resulting object, you can see the symbol is used verbatim:
6244 </p>
6245 <pre>00000000000001f0 T A function name that is a complete sentence.</pre>
6246 {#see_also|Exporting a C Library#}
62186247 {#header_close#}
62196248
62206249 {#header_open|@fence#}
......@@ -8074,6 +8103,7 @@ pub fn build(b: *Builder) void {
80748103$ ./test
80758104$ echo $?
807681050</code></pre>
8106 {#see_also|export#}
80778107 {#header_close#}
80788108 {#header_open|Mixing Object Files#}
80798109 <p>