英文:
What do "//sys ..." comments mean?
问题
Microsoft的winio包中包含以//sys开头的注释。
例如:
//sys connectNamedPipe(pipe syscall.Handle, o *syscall.Overlapped) (err error) = ConnectNamedPipe
我怀疑它们有特殊的含义。
这些注释是什么意思?
文档在哪里可以找到?
英文:
Microsoft's winio package contains comments starting with //sys.
For example:
//sys connectNamedPipe(pipe syscall.Handle, o *syscall.Overlapped) (err error) = ConnectNamedPipe
I suspect they have special meaning.
What do these comments mean?
And where is the documentation?
答案1
得分: 1
mkwinsyscall 使用//sys
注释来确定需要生成的代码:
mkwinsyscall 生成 Windows 系统调用的函数体。它解析命令行上指定的包含函数原型的所有文件(例如 syscall_windows.go),并将系统调用的函数体打印到标准输出。原型由以 "//sys" 开头的行标记,并且如果将 "//sys" 替换为 "func",则读取起来类似于函数声明,但是...
运行 go generate
将导致它被调用,原因是由于 这个注释(输出将被发送到 zsyscall_windows.go):
//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go ./*.go
英文:
mkwinsyscall uses the //sys
comments to determine what code it needs to generate:
>mkwinsyscall generates windows system call bodies. It parses all files specified on command line containing function prototypes (like syscall_windows.go) and prints system call bodies to standard output.
>The prototypes are marked by lines beginning with "//sys" and read
like func declarations if //sys is replaced by func, but...
Running go generate
will lead to it being called due to this comment (with output going to zsyscall_windows.go):
//go:generate go run github.com/Microsoft/go-winio/tools/mkwinsyscall -output zsyscall_windows.go ./*.go
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论