Created
August 1, 2016 01:56
-
-
Save nhooyr/314e8b5334639280095437230957a982 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
/* | |
#cgo CFLAGS: -x objective-c | |
#cgo LDFLAGS: -framework Cocoa | |
#import <Cocoa/Cocoa.h> | |
int writeString(const char *data) { | |
@autoreleasepool { | |
[[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSPasteboardTypeString] owner:nil]; | |
[[NSPasteboard generalPasteboard] setString:[NSString stringWithUTF8String: data] forType:NSPasteboardTypeString]; | |
} | |
return 0; | |
} | |
*/ | |
import "C" | |
import "os" | |
func main() { | |
C.writeString(C.CString(os.Args[0])) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment