2.5 深入CGO编程深入CGO编程 chai2010(柴树杉) @青云QingCloud ’ alt=‘OCR图片’/> 感谢 GopherChina http://gopherchina.org/ 感谢韦光京对CGO的贡献 ld: add one empty symbol into pe to make dumpbin works. 1ac7a69 Wei GuangjingJul 23,2011 at 9:21 AM cgo: windows amd64 port 9f63659 Wei Guangjing Jul 19,2011 at 10:47 PM net: windows/amd64 8l: emit DWARF in Windows PE. f1751e7 Wei Guangjing Jan 21,2011 at 12:28 AM cgo: windows/386 port 1aa2d88 Wei Guangjing Jan 20,2011 at 11:22 PM 6l: windows/amd64 0 码力 | 145 页 | 2.29 MB | 1 月前3
5.cgo 原理解析及优化实践## GCN ## cgo 原理解析及优化实践  朱德江 蚂蚁集团 MOSN 核心成员 Golang contributor Envoy Golang extension maintainer ## 0 公众号 • 开源爱好者  背景介绍 01 cgo 工作机制 02 cgo 调度机制 03 CPU 优化 04 GC 优化 05 ## 第一部分 背景介绍 ## 网关发展历史  ## Preparation: Driver - Metal as Example /* #cgo CFLAGS: -Werror -fmodules -x objective-c #cgo LDFLAGS: -framework Metal -framework CoreGraphics #include "mtl.h" */ Go when using GPUs Costs of Cgo o Fundamental infrastructure o Common abstraction o Writing and debugging shaders Conclusion and outlooks ## Challenge 1: The cost of Cgo Operations on GPU involves involves system calls, and easiest approach is to use Cgo: /* #cgo CFLAGS: -Werror -fmodules -x objective-c #cgo LDFLAGS: -framework Metal -framework CoreGraphics #include "mtl.h" */ import "C"0 码力 | 57 页 | 4.62 MB | 2 年前3
Go语言 - 一些简单的读书分享c2a2c9737d85a42790309bfa0aff5b7/p2_2.jpg) · 我是作者之一 - 这本书在写的时候国内的 Go 语言书很少 • 现在销量约 2w+ - 直到现在,CGO 和 plan9 汇编的内容依然是独一份 ## 目录 为什么要读书 01 带着问题读书 02 怎么样读书 03 应该读哪些书 04 ## 第一部分 为什么要读书 ## 为什么要读书 -0 码力 | 16 页 | 9.09 MB | 2 年前3
01. MOSN 高性能网络扩展实践 - 王发康GoLang Runtime 还未完全支持;不能复用已有的 SDK,需要做网络 IO 适配改造| |External-Proc Extension|跨语言支持、隔离性|需要跨进程通信性能低 (UDS vs CGO 1KB Latency 差 8 倍);需要扩展具备 gRPC server 能力,多进程管理复杂| |MOSN(GoLang) Extension|可复用 MOSN 现有的 filter 能力,改造成本低;研发效率高 contact here. 通过 CGO API 作为 Envoy 的 GoLang 扩展通道是不错的 IMHO, if we wanted to go out-of-process, something like ext_proc is desirable. If we want to stay in process, I think this CGO API is interesting 方案分析 ## CGO 是 Go 官方出品 golang.org/cmd/cgo/ ## Command cgo Using cgo with the go command Go references to C C references to Go Passing pointers Special cases Using cgo directly ## 社区 CGO 维护频度 Go0 码力 | 29 页 | 2.80 MB | 2 年前3
1.2.4 Go on GPU为例 package mtl // import “changkun.de/x/gopherchina2023gogpu/gpu/mtl” /* #cgo CFLAGS: -Werror -fmodules -x objective-c #cgo LDFLAGS: -framework Metal -framework CoreGraphics #include "mtl.h" 加速 • 使用 Go 进行 GPU 计算的挑战 ○ Cgo 的开销 ○ 基础设施的积累 ○ 设计 GPU 的统一抽象 ○ 着色器的编写和调试 挑战1: Cgo的成本 所有涉及显卡相关的操作或多或少涉及系统调用,最简单的方式就是引入 Cgo /* #cgo CFLAGS: -Werror -fmodules -x objective-c #cgo LDFLAGS: -framework Metal com/go-gl/gl 如 https://github.com/go-gl/glfw 挑战1: Cgo的成本 所有涉及显卡相关的操作或多或少涉及系统调用,最简单的方式就是引入 Cgo /* #cgo CFLAGS: -Werror -fmodules -x objective-c #cgo LDFLAGS: -framework Metal -framework CoreGraphics0 码力 | 55 页 | 4.79 MB | 1 月前3
2.6 Go in Linux Desktop EnvironmentDeepin XX ? ## 遇到的问题 • 与其他组件的融合 • X11 ## 解决方式 • using CGO to get anything • Pure golang library CGO Tips • Go-C C-Go • struct • array ## CGO Tips: Go call C functions && types convert package glue-C is far less than perl、python ... ## CGO Tips: Even more convenient than C at make time package main /* #cgo pkg-config: gtk+-3.0 #includevoid write_c_funct GTK_WINDOW_TOPLEVEL) C.write_c_function_in_go_source(w) C.gtk_widget_show_all(w) C.gtk_main() } ## CGO Tips: Struct is also easy to use package main /* #include#include struct tm* 0 码力 | 36 页 | 414.50 KB | 2 年前3
1.5 Badger_ Fast Key-Value DB in Goreplacement for Go map Motivation and Outcome Cgo is not Go Some people,when confronted with a problem,think “I know,I’ll use cgo.” Now they have two problems. ->Cgo is not Go, Dave Cheney RocksDB Great write Required Cgo. BoltDB Pure Go. Great read throughput. Cons: Bad write throughput. Why build it? Go native key-value DB for Dgraph. No compromise in read-write performance. Avoid Cgo. What workload. All your data can fit in memory easily. Use Badger if… You Go! You want to avoid Cgo. You want a performant read-write workload. You access data concurrently (many goroutines accessing0 码力 | 74 页 | 1.70 MB | 1 月前3
Golang Manual By AstaXie-20120522add to archive // Cgo directives CgoCFLAGS []string // cgo: flags for C compiler CgoLDFLAGS []string // cgo: flags for linker CgoPkgConfig []string // cgo: pkg-config names Gccgo is a GCC front-end that can, with care, be linked with GCC-compiled C or C++ programs. The cgo program provides the mechanism for a "foreign function interface" to allow safe calling of https://github.com/ziutek/mymysql - ODBC: https://bitbucket.org/miquella/mgodbc - Postgres (uses cgo): https://github.com/jbarham/gopgsqldriver - Postgres (pure Go): https://github.com/bmizerany/pq0 码力 | 6205 页 | 12.83 MB | 2 年前3
Golang 微服务在腾讯游戏用户运营领域的探索及实践(otto) Python/PHP cLua/cLuaJIT GopherLua • Expression、Learning cost • CGO overhead • Performance • CGO / Thread Safe • CGO / Thread overhead • Performance / API friendly ## 嵌入式Lua虚拟机 Gopherlua0 码力 | 34 页 | 1.22 MB | 2 年前3
共 64 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7













