Work with gssapi.h
struct gss_name_struct; typedef struct gss_name_struct * gss_name_t;
I am trying to figure out how to properly initialize a variable containing this,
var output_name C.gss_name_t = &C.struct_gss_name_struct{}
But functions like gss_import_name act as if I passed them a null pointer. What is the correct way to properly initialize and use these empty structures using CGO?
typedefs . Go - C, , . go C-, . go .
C , , Go. cgo, , . go tool cgo -godefs filename.go cgo . , go .
go tool cgo -godefs filename.go
// statement in the original .go file //var output_name C.gss_name_t = &C.struct_gss_name_struct{} // output from cgo -godefs // var output_name *[0]byte = &[0]byte{} // or more succinctly output_name := &[0]byte{} // output_name can be converted directly to a C.gss_name_t fmt.Printf("%+v\n", output_name) fmt.Printf("%+v\n", C.gss_name_t(output_name))
Source: https://habr.com/ru/post/1536581/More articles:Negative fill color in AreaSpline chart - highchartsШаблоны для реализации расширения ресурсов в веб-интерфейсе ASP.NET - c#algorithm, image processing, flood - javaHow to use lein attempt in cider? - emacsThe difference in the declaration is: "var x = .." vs "var x; x = .." - variablesnode.js runInNewContext with untrusted code - javascriptСтолбцы CSS: укажите последний дочерний элемент в каждом столбце? - cssЕсть ли запрос JIra, который вернет все истории без EPIC? - jiraTitan ByteArray for Blob Image - character-encodingHow is an argument about itself magically passed to instance methods? - pythonAll Articles