Skip to content

Instantly share code, notes, and snippets.

@hajimehoshi
Created October 4, 2013 17:30
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hajimehoshi/6829595 to your computer and use it in GitHub Desktop.
Save hajimehoshi/6829595 to your computer and use it in GitHub Desktop.
Show a Cocoa window by Go
package main
// #cgo CFLAGS: -x objective-c
// #cgo LDFLAGS: -framework Cocoa
// #import <Cocoa/Cocoa.h>
//
// void run() {
// @autoreleasepool {
// NSApplication* app = [NSApplication sharedApplication];
// NSWindow* window = [[NSWindow alloc]
// initWithContentRect:NSMakeRect(0,0,200,200)
// styleMask:NSTitledWindowMask
// backing:NSBackingStoreBuffered
// defer:NO];
// [window orderFrontRegardless];
// [app run];
// }
// }
//
import "C"
func main() {
C.run()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment