本文整理汇总了Golang中C.init函数的典型用法代码示例。如果您正苦于以下问题:Golang init函数的具体用法?Golang init怎么用?Golang init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Init
//Init initializing the dissection. If opening inputfile or savefile fail,
//return err. After dissection finish, should use Clean() to end the dissection.
func Init(inputfile, outputfile string) error {
var err C.int
if outputfile == "" {
err = C.init(C.CString(inputfile), nil)
} else {
err = C.init(C.CString(inputfile), C.CString(outputfile))
}
if err != 0 {
return fmt.Errorf("can't open file")
}
return nil
}
示例2: main
func main() {
C.init(C.CString(os.Args[1]))
for _, a := range os.Args[2:] {
C.write_file(C.CString(a+"\n"), C.size_t(len(a)+1))
}
C.finish()
}
示例3: init
func init() {
if AlwaysFalse {
// by referencing this C init() in a noop test, it will ensure the compiler
// links in the C function.
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65134
C.init()
}
}
示例4: init
func init() {
C.init()
// Mirror db.
for rows := 3; rows <= BoardSize; rows++ {
for cols := 3; cols <= BoardSize; cols++ {
q := (*queue)(C.db[rows][cols])
db[rows][cols] = q.slice()
}
}
}
示例5: initGTK
func initGTK() {
// pass command line arguments to GTK+
argc := int(C.init(C.int(len(os.Args)), unsafe.Pointer(&os.Args[0])))
// update os.Args
os.Args = os.Args[0:0]
for i := 0; i < argc; i++ {
os.Args = append(os.Args, C.GoString(C.return_arg(C.int(i))))
}
fmt.Println("Remaining command line arguments:", os.Args)
}
示例6: Initialize
// Initialize sets up the application properties.
func Initialize(title string, imageData []byte, items []MenuItem) {
cTitle := C.CString(title)
defer C.free(unsafe.Pointer(cTitle))
img, freeImg := create_image(Image{Kind: "png", Bytes: imageData})
defer freeImg()
// Initialize menu.
C.init(cTitle, img)
menuItems = items
for id, item := range menuItems {
addItem(id, item)
}
}
示例7: main
func main() {
InitI18n()
Textdomain("dde-daemon")
if !lib.UniqueOnSession("com.deepin.daemon") {
logger.Warning("There already has a dde-daemon running.")
return
}
if len(os.Args) >= 2 {
for _, disabledModuleName := range os.Args[1:] {
loader.Enable(disabledModuleName, false)
}
}
C.init()
proxy.SetupProxy()
initModules()
listenDaemonSettings()
loader.StartAll()
defer loader.StopAll()
go func() {
if err := dbus.Wait(); err != nil {
logger.Errorf("Lost dbus: %v", err)
os.Exit(-1)
} else {
logger.Info("dbus connection is closed by user")
os.Exit(0)
}
}()
ddeSessionRegister()
dbus.DealWithUnhandledMessage()
glib.StartLoop()
}
示例11: New
func New(prompt string) *Tecla {
prompts := make(map[string]*C.char)
return &Tecla{C.init(), intern(prompts, prompt), prompts}
}
示例12: test5227
func test5227(t *testing.T) {
C.init()
}
示例13: Init
// Init initializes the graphics subsystem
func Init() (int, int) {
var rh, rw C.int
C.init(&rw, &rh)
return int(rw), int(rh)
}
示例14: initializeXmlSec
func initializeXmlSec(signatureManager *C.SignatureManager) {
returnCode := C.init(signatureManager)
if returnCode != 0 {
panic("xmlsec initialization failed")
}
}