mac-frameworks

How to use macOS/OS X Frameworks in go

烂漫一生 提交于 2020-01-15 08:22:06
问题 For example, how to use CoreGraphics and CoreFoundation to manipulate the screen and process data on macOS. 回答1: Let's say we want to use CoreGraphics and CoreFoundation to capture the screen and get the image data: package main // To use the two libraries we need to define the respective flags, include the required header files and import "C" immediately after import ( // #cgo LDFLAGS: -framework CoreGraphics // #cgo LDFLAGS: -framework CoreFoundation // #include <CoreGraphics/CoreGraphics.h