The Zig Programming Language 0.2.0 Documentationa newline is appended and the string literal continues. const hello_world_in_c = \\#include <stdio.h> \\ \\int main(int argc, char **argv) { \\ printf("hello world\n"); \\ return For a multiline C string literal, prepend c to each \\: const c_string_literal = c\\#include <stdio.h> c\\ c\\int main(int argc, char **argv) { c\\ printf("hello world\n"); c\\ @cImport({ // See https://github.com/zig-lang/zig/issues/515 @cDefine("_NO_CRT_STDIO_INLINE", "1"); @cInclude("stdio.h"); }); pub fn main() void { _ = c.printf(c"hello\n"); } $ zig build-exe test0 码力 | 117 页 | 2.84 MB | 1 年前3
The Zig Programming Language 0.5.0 Documentationa newline is appended and the string literal continues. const hello_world_in_c = \\#include <stdio.h> \\ \\int main(int argc, char **argv) { \\ printf("hello world\n"); \\ return For a multiline C string literal, prepend c to each \\: const c_string_literal = c\\#include <stdio.h> c\\ c\\int main(int argc, char **argv) { c\\ printf("hello world\n"); c\\ @cInclude("epoxy/gl.h"); @cInclude("GLFW/glfw3.h"); @cDefine("STBI_ONLY_PNG", ""); @cDefine("STBI_NO_STDIO", ""); @cInclude("stb_image.h"); }); The above example demonstrates using pub to qualify the0 码力 | 224 页 | 5.80 MB | 1 年前3
The Zig Programming Language 0.12.0 Documentationstring literal continues. multiline_string_literals.zig const hello_world_in_c = \\#include <stdio.h> \\ \\int main(int argc, char **argv) { \\ printf("hello world\n"); \\ return @cInclude("epoxy/gl.h"); @cInclude("GLFW/glfw3.h"); @cDefine("STBI_ONLY_PNG", ""); @cDefine("STBI_NO_STDIO", ""); @cInclude("stb_image.h"); }); The above example demonstrates using pub to qualify the @cImport({ // See https://github.com/ziglang/zig/issues/515 @cDefine("_NO_CRT_STDIO_INLINE", "1"); @cInclude("stdio.h"); }); pub fn main() void { _ = c.printf("hello\n"); } Shell $ zig build-exe0 码力 | 241 页 | 7.37 MB | 1 年前3
The Zig Programming Language 0.9.1 Documentationliteral continues. multiline_string_literals.zig 1 const hello_world_in_c = 2 \\#include <stdio.h> 3 \\ 4 \\int main(int argc, char **argv) { 5 \\ printf("hello world\n"); 6 3 @cInclude("GLFW/glfw3.h"); 4 @cDefine("STBI_ONLY_PNG", ""); 5 @cDefine("STBI_NO_STDIO", ""); 6 @cInclude("stb_image.h"); 7 }); The above example demonstrates using pub to qualify // See https://github.com/ziglang/zig/issues/515 3 @cDefine("_NO_CRT_STDIO_INLINE", "1"); 4 @cInclude("stdio.h"); 5 }); 6 pub fn main() void { 7 _ = c.printf("hello\n"); 8 } Shell0 码力 | 234 页 | 7.90 MB | 1 年前3
The Zig Programming Language 0.1.1 Documentationa newline is appended and the string literal continues. const hello_world_in_c = \\#include <stdio.h> \\ \\int main(int argc, char **argv) { \\ printf("hello world\n"); \\ return For a multiline C string literal, prepend c to each \\: const c_string_literal = c\\#include <stdio.h> c\\ c\\int main(int argc, char **argv) { c\\ printf("hello world\n"); c\\ builtin function can be used to directly import symbols from .h files: const c = @cImport(@cInclude("stdio.h")); pub fn main() -> %void { c.printf("hello\n"); } The @cImport function takes an expression0 码力 | 82 页 | 2.67 MB | 1 年前3
The Zig Programming Language 0.11.0 Documentationliteral continues. multiline_string_literals.zig 1 const hello_world_in_c = 2 \\#include <stdio.h> 3 \\ 4 \\int main(int argc, char **argv) { 5 \\ printf("hello world\n"); 6 3 @cInclude("GLFW/glfw3.h"); 4 @cDefine("STBI_ONLY_PNG", ""); 5 @cDefine("STBI_NO_STDIO", ""); 6 @cInclude("stb_image.h"); 7 }); The above example demonstrates using pub to qualify // See https://github.com/ziglang/zig/issues/515 3 @cDefine("_NO_CRT_STDIO_INLINE", "1"); 4 @cInclude("stdio.h"); 5 }); 6 pub fn main() void { 7 _ = c.printf("hello\n"); 8 } Shell0 码力 | 238 页 | 7.80 MB | 1 年前3
The Zig Programming Language 0.10.1 Documentationliteral continues. multiline_string_literals.zig 1 const hello_world_in_c = 2 \\#include <stdio.h> 3 \\ 4 \\int main(int argc, char **argv) { 5 \\ printf("hello world\n"); 6 3 @cInclude("GLFW/glfw3.h"); 4 @cDefine("STBI_ONLY_PNG", ""); 5 @cDefine("STBI_NO_STDIO", ""); 6 @cInclude("stb_image.h"); 7 }); The above example demonstrates using pub to qualify // See https://github.com/ziglang/zig/issues/515 3 @cDefine("_NO_CRT_STDIO_INLINE", "1"); 4 @cInclude("stdio.h"); 5 }); 6 pub fn main() void { 7 _ = c.printf("hello\n"); 8 } Shell0 码力 | 239 页 | 8.03 MB | 1 年前3
The Zig Programming Language 0.7.1 Documentationa newline is appended and the string literal continues. const hello_world_in_c = \\#include <stdio.h> \\ \\int main(int argc, char **argv) { \\ printf("hello world\n"); \\ return @cInclude("epoxy/gl.h"); @cInclude("GLFW/glfw3.h"); @cDefine("STBI_ONLY_PNG", ""); @cDefine("STBI_NO_STDIO", ""); @cInclude("stb_image.h"); }); The above example demonstrates using pub to qualify the @cImport({ // See https://github.com/ziglang/zig/issues/515 @cDefine("_NO_CRT_STDIO_INLINE", "1"); @cInclude("stdio.h"); }); pub fn main() void { _ = c.printf("hello\n"); } $ zig build-exe test0 码力 | 225 页 | 5.74 MB | 1 年前3
The Zig Programming Language 0.6.0 Documentationa newline is appended and the string literal continues. const hello_world_in_c = \\#include <stdio.h> \\ \\int main(int argc, char **argv) { \\ printf("hello world\n"); \\ return @cInclude("epoxy/gl.h"); @cInclude("GLFW/glfw3.h"); @cDefine("STBI_ONLY_PNG", ""); @cDefine("STBI_NO_STDIO", ""); @cInclude("stb_image.h"); }); The above example demonstrates using pub to qualify the @cImport({ // See https://github.com/ziglang/zig/issues/515 @cDefine("_NO_CRT_STDIO_INLINE", "1"); @cInclude("stdio.h"); }); pub fn main() void { _ = c.printf("hello\n"); } $ zig build-exe test0 码力 | 214 页 | 5.37 MB | 1 年前3
The Zig Programming Language 0.3.0 Documentationa newline is appended and the string literal continues. const hello_world_in_c = \\#include <stdio.h> \\ \\int main(int argc, char **argv) { \\ printf("hello world\n"); \\ return For a multiline C string literal, prepend c to each \\: const c_string_literal = c\\#include <stdio.h> c\\ c\\int main(int argc, char **argv) { c\\ printf("hello world\n"); c\\ @cImport({ // See https://github.com/ziglang/zig/issues/515 @cDefine("_NO_CRT_STDIO_INLINE", "1"); @cInclude("stdio.h"); }); pub fn main() void { _ = c.printf(c"hello\n"); } $ zig build-exe0 码力 | 175 页 | 4.08 MB | 1 年前3
共 12 条
- 1
- 2













