Skip to content

Instantly share code, notes, and snippets.

@cxfksword
Last active August 29, 2015 14:03
Show Gist options
  • Save cxfksword/c96a3589cfcc4b93673c to your computer and use it in GitHub Desktop.
Save cxfksword/c96a3589cfcc4b93673c to your computer and use it in GitHub Desktop.
golang 在windows上执行syscall调用dll相关资料
//http://golang.org/src/pkg/syscall/dll_windows.go
//http://golang.org/src/pkg/runtime/syscall_windows_test.go?h=int
//http://golang.org/src/pkg/syscall/syscall_windows.go
//http://wendal.net/2013/0406.html
//http://outofmemory.cn/code-snippet/3006/golang-call-API-liechu-window-suo-exist-run-process
// char -> byte
// char* -> *byte
// wchar_t/LCHAR -> uint16
// wchar_t/LPCHAR -> *uint16
// LPARAM -> uintptr
// CALLBACK -> uintptr
// Correct. All syscall.SyscallX() arguments must be 4 bytes each. That
// how all Windows system dlls are.
// go结构需要按顺序拆散传给函数
// uintptr(rect.X),uintptr(rect.Y),uintptr(rect.Width),uintptr(rect.Height)
// char* => uintptr(unsafe.Pointer(&buf[0])).
// syscall.StringArrayPtr char*?
// callback => syscall.NewCallBack
// http://www.cnblogs.com/c1230v/articles/1669660.html.
cgo自动加载指定共享库
https://github.com/GeertJohan/cgo.wchar/blob/master/convert.go
http://akrennmair.github.io/golang-cgo-slides/#1
go build代码:
http://golang.org/src/cmd/go/build.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment