func Deinit() error {
  if cbox != nil {
    result := C.GoVboxIVirtualBoxRelease(cbox)
    if C.GoVboxFAILED(result) != 0 {
      return errors.New(
          fmt.Sprintf("Failed to release IVirtualBox: %x", result))
    }
    cbox = nil
  }
  if client != nil {
    C.GoVboxClientUninitialize()
    client = nil
  }
  return nil
}
Deinit cleans up the VirtualBox global state.
After this method is called, all VirtualBox-related objects are invalid.
It returns any error encountered.
package vbox
import "C"   
import (
  "errors"
  "fmt"
  "unsafe"
)
var client *C.IVirtualBoxClient = nil
var cbox *C.IVirtualBox = nil
var glueInitialized = false
var AppVersion uint = 0
var ApiVersion uint = 0
func Init() error {
  if glueInitialized == false {
    result := C.GoVboxCGlueInit()
    if C.GoVboxFAILED(result) != 0 {
      cmessage := C.GoString(&C.g_szVBoxErrMsg[0])
      return errors.New(fmt.Sprintf("VBoxCGlueInit failed: %s", cmessage))
    }
    glueInitialized = true
    AppVersion = uint(C.GoVboxGetAppVersion())
    ApiVersion = uint(C.GoVboxGetApiVersion())
  }
  if client == nil {
    result := C.GoVboxClientInitialize(&client)
    if C.GoVboxFAILED(result) != 0 || client == nil {
      client = nil
      return errors.New(fmt.Sprintf("pfnClientInitialize failed: %x", result))
    }
  }
  if cbox == nil {
    result := C.GoVboxGetVirtualBox(client, &cbox)
    if C.GoVboxFAILED(result) != 0 || cbox == nil {
      cbox = nil
      return errors.New(fmt.Sprintf("Failed to get IVirtualBox: %x", result))
    }
  }
  return nil
}