Documentation ¶
Overview ¶
Package genwinsyscallproto generates Windows syscall function prototypes ("//sys ..." comments) using given win32metadata information parsed by go-winmd as specified by ECMA-335.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { Metadata *winmd.Metadata // contains filtered or unexported fields }
Context stores data about syscall generation so far, and to improve generation performance. It keeps track of the list of used typedefs that may need to also be defined in generated Go code.
func NewContext ¶
NewContext creates a Context. Reads some tables in their entirety to fill in internal index maps that improve generation performance at the cost of startup time.
func (*Context) WriteMethod ¶
func (c *Context) WriteMethod(w io.StringWriter, methodIndex winmd.Index, method *winmd.MethodDef) error
WriteMethod writes to w the signature for "method" in x/sys/windows/mkwinsyscall format. Uses the parsed metadata to determine the meaning of data inside the given method.
goName defines what the name of the method will be in Go after mkwinsyscall is applied. It may be different from the method's actual name.
moduleName should be the name of the module that contains the syscall, or empty string if none is required. (mkwinsyscall has defaults that may be acceptable.) It is recommended to read the DllImport pseudo-attribute (§II.21.2.1) to determine this value.
methodIndex and method must match. Only methodIndex is necessary, but method is also accepted to avoid unnecessary decoding. The caller has likely already decoded the method to filter by name.
func (*Context) WriteUsedTypeDefs ¶
func (c *Context) WriteUsedTypeDefs(w io.StringWriter) error
WriteUsedTypeDefs writes Go definitions for TypeDefs that were discovered during WriteMethod calls to b. For a given Context c, only call this method one time, and only after all WriteMethod calls are complete.