Submit Search
Upload
Py + gi 高效 c 庫整合方案
•
0 likes
•
198 views
L
Leo Zhou
Follow
Pycon China 2015
Read less
Read more
Technology
Report
Share
Report
Share
1 of 49
Download now
Download to read offline
Recommended
Light talk @ coscup 2011 : Incremental Global Prelink for Android
Light talk @ coscup 2011 : Incremental Global Prelink for Android
Kito Cheng
Python的module机制与最佳实践
Python的module机制与最佳实践
Leo Zhou
Pycon China 2015
基于Tornado打造通用长链接代理服务器
基于Tornado打造通用长链接代理服务器
Leo Zhou
Pycon China 2015
Python与抓包
Python与抓包
Leo Zhou
Pycon China 2015
Py ladies 0928
Py ladies 0928
Chia-Yi Yen
Py ladies 0928
Py ladies 0928
Yen_CY
Python安全编码
Python安全编码
Leo Zhou
Pycon China 2015
Android C Library: Bionic 成長計畫
Android C Library: Bionic 成長計畫
Kito Cheng
本議程主要探討 Android 的 C Library : Bionic , bionic 與一般 Linux 所使用的 C Library 有所不同,為達到輕薄短小, 因此相較下缺少部份功能的實做, 本議程將探討 bionic 何處尚可改善以及發表我們對於 bionic 所改善的部份, 其中改善包含 bionic 中的 Dynamic Linker 及對於 Profiling 的支援.
Recommended
Light talk @ coscup 2011 : Incremental Global Prelink for Android
Light talk @ coscup 2011 : Incremental Global Prelink for Android
Kito Cheng
Python的module机制与最佳实践
Python的module机制与最佳实践
Leo Zhou
Pycon China 2015
基于Tornado打造通用长链接代理服务器
基于Tornado打造通用长链接代理服务器
Leo Zhou
Pycon China 2015
Python与抓包
Python与抓包
Leo Zhou
Pycon China 2015
Py ladies 0928
Py ladies 0928
Chia-Yi Yen
Py ladies 0928
Py ladies 0928
Yen_CY
Python安全编码
Python安全编码
Leo Zhou
Pycon China 2015
Android C Library: Bionic 成長計畫
Android C Library: Bionic 成長計畫
Kito Cheng
本議程主要探討 Android 的 C Library : Bionic , bionic 與一般 Linux 所使用的 C Library 有所不同,為達到輕薄短小, 因此相較下缺少部份功能的實做, 本議程將探討 bionic 何處尚可改善以及發表我們對於 bionic 所改善的部份, 其中改善包含 bionic 中的 Dynamic Linker 及對於 Profiling 的支援.
第三名 3rd zhyict
第三名 3rd zhyict
Leo Zhou
赵淮毅, 吴嘉皓, 刁祖龙 Huaiyi Zhao, Jiahao Wu, Zulong Diao 中科院 计算所
异常检测在苏宁的实践
异常检测在苏宁的实践
Leo Zhou
汤泳 Yong Tang 苏宁科技集团监控云研发中心 总监
第二名 2nd 火眼金睛
第二名 2nd 火眼金睛
Leo Zhou
周波, 孙发强 Bo Zhou, Faqiang Sun 国家互联网应急中心
第四名 4th H3C AI Institute
第四名 4th H3C AI Institute
Leo Zhou
张闯, 赵国柱, 陈瑞 Chuang Zhang, Guozhu Zhao, Rui Chen 新华三 AI研究院
第一名 1st Bocoiops
第一名 1st Bocoiops
Leo Zhou
李杰, 崔世彬, 于海鹏, 陈晓峰, 吴琼 Jie Li, Shibin Cui, Haipeng Yu, Xiaofeng Chen, Qiong Wu 亿阳信通 技术架构部
第六名 6th Aurora
第六名 6th Aurora
Leo Zhou
靖宇涵, 何波, 李天星, 张凌昕 Yuhan Jing, Bo He, Tianxing Li, Lingxin Zhang 北京邮电大学 网络技术研究院
AI使能网络自动驾驶 AI Building Autonomous Driving Network
AI使能网络自动驾驶 AI Building Autonomous Driving Network
Leo Zhou
何玉宝 Yubao He 华为公司可服务性委员会 主任
2.2 go在阿里云cdn系统的应用
2.2 go在阿里云cdn系统的应用
Leo Zhou
Gopher China 2016
1.6 米嘉 gobuildweb
1.6 米嘉 gobuildweb
Leo Zhou
Gopher China 2016
1.4 go在数据存储上面的应用—毛剑
1.4 go在数据存储上面的应用—毛剑
Leo Zhou
Gopher China 2016
1.2 刘奇 go在分布式数据库中的应用
1.2 刘奇 go在分布式数据库中的应用
Leo Zhou
Gopher China 2016
Protocol libraries the right way
Protocol libraries the right way
Leo Zhou
Pycon
美团数据库运维平台介绍
美团数据库运维平台介绍
Leo Zhou
2015 中国数据库大会
特卖场景下的大数据平台和机器学习实践
特卖场景下的大数据平台和机器学习实践
Leo Zhou
贝贝网-周黄玲
我的互联网运维理论与实践
我的互联网运维理论与实践
Leo Zhou
Ucloud dev opsworkshop 7.25
如何选择 Docker 监控方案
如何选择 Docker 监控方案
Leo Zhou
刘斌 OneAPM
美团数据库运维平台介绍
美团数据库运维平台介绍
Leo Zhou
- 初期仅支持在线的DDL操作、数据库账户申请操作以及数据库相关集群信息查询操作 - 主要功能: 仪表盘, 工单, 公告, 新集群搭建(包括mysql和中间件), 扩容从库, 建库&添加账, 自助表变更, 备份 - 小功能点: checksum管理, 中间件管理、历史、实时processlist查看、历史innodb status查看、SQL评审等 - 由于很多数据库操作没有办法方便得回滚,需要DBA手动回滚. 所以在必须加上详细的前置和后置检查工作
The net is dark and full of terrors - James Bennett
The net is dark and full of terrors - James Bennett
Leo Zhou
Django Con Euro 2015
Hypothesis randomised testing for django
Hypothesis randomised testing for django
Leo Zhou
DjangoCon Europe 2015
NoSQL@VIP — 唯品会NoSQL平台⾃动化发展及运维经验分享
NoSQL@VIP — 唯品会NoSQL平台⾃动化发展及运维经验分享
Leo Zhou
2015中华数据库与运维大会
More Related Content
More from Leo Zhou
第三名 3rd zhyict
第三名 3rd zhyict
Leo Zhou
赵淮毅, 吴嘉皓, 刁祖龙 Huaiyi Zhao, Jiahao Wu, Zulong Diao 中科院 计算所
异常检测在苏宁的实践
异常检测在苏宁的实践
Leo Zhou
汤泳 Yong Tang 苏宁科技集团监控云研发中心 总监
第二名 2nd 火眼金睛
第二名 2nd 火眼金睛
Leo Zhou
周波, 孙发强 Bo Zhou, Faqiang Sun 国家互联网应急中心
第四名 4th H3C AI Institute
第四名 4th H3C AI Institute
Leo Zhou
张闯, 赵国柱, 陈瑞 Chuang Zhang, Guozhu Zhao, Rui Chen 新华三 AI研究院
第一名 1st Bocoiops
第一名 1st Bocoiops
Leo Zhou
李杰, 崔世彬, 于海鹏, 陈晓峰, 吴琼 Jie Li, Shibin Cui, Haipeng Yu, Xiaofeng Chen, Qiong Wu 亿阳信通 技术架构部
第六名 6th Aurora
第六名 6th Aurora
Leo Zhou
靖宇涵, 何波, 李天星, 张凌昕 Yuhan Jing, Bo He, Tianxing Li, Lingxin Zhang 北京邮电大学 网络技术研究院
AI使能网络自动驾驶 AI Building Autonomous Driving Network
AI使能网络自动驾驶 AI Building Autonomous Driving Network
Leo Zhou
何玉宝 Yubao He 华为公司可服务性委员会 主任
2.2 go在阿里云cdn系统的应用
2.2 go在阿里云cdn系统的应用
Leo Zhou
Gopher China 2016
1.6 米嘉 gobuildweb
1.6 米嘉 gobuildweb
Leo Zhou
Gopher China 2016
1.4 go在数据存储上面的应用—毛剑
1.4 go在数据存储上面的应用—毛剑
Leo Zhou
Gopher China 2016
1.2 刘奇 go在分布式数据库中的应用
1.2 刘奇 go在分布式数据库中的应用
Leo Zhou
Gopher China 2016
Protocol libraries the right way
Protocol libraries the right way
Leo Zhou
Pycon
美团数据库运维平台介绍
美团数据库运维平台介绍
Leo Zhou
2015 中国数据库大会
特卖场景下的大数据平台和机器学习实践
特卖场景下的大数据平台和机器学习实践
Leo Zhou
贝贝网-周黄玲
我的互联网运维理论与实践
我的互联网运维理论与实践
Leo Zhou
Ucloud dev opsworkshop 7.25
如何选择 Docker 监控方案
如何选择 Docker 监控方案
Leo Zhou
刘斌 OneAPM
美团数据库运维平台介绍
美团数据库运维平台介绍
Leo Zhou
- 初期仅支持在线的DDL操作、数据库账户申请操作以及数据库相关集群信息查询操作 - 主要功能: 仪表盘, 工单, 公告, 新集群搭建(包括mysql和中间件), 扩容从库, 建库&添加账, 自助表变更, 备份 - 小功能点: checksum管理, 中间件管理、历史、实时processlist查看、历史innodb status查看、SQL评审等 - 由于很多数据库操作没有办法方便得回滚,需要DBA手动回滚. 所以在必须加上详细的前置和后置检查工作
The net is dark and full of terrors - James Bennett
The net is dark and full of terrors - James Bennett
Leo Zhou
Django Con Euro 2015
Hypothesis randomised testing for django
Hypothesis randomised testing for django
Leo Zhou
DjangoCon Europe 2015
NoSQL@VIP — 唯品会NoSQL平台⾃动化发展及运维经验分享
NoSQL@VIP — 唯品会NoSQL平台⾃动化发展及运维经验分享
Leo Zhou
2015中华数据库与运维大会
More from Leo Zhou
(20)
第三名 3rd zhyict
第三名 3rd zhyict
异常检测在苏宁的实践
异常检测在苏宁的实践
第二名 2nd 火眼金睛
第二名 2nd 火眼金睛
第四名 4th H3C AI Institute
第四名 4th H3C AI Institute
第一名 1st Bocoiops
第一名 1st Bocoiops
第六名 6th Aurora
第六名 6th Aurora
AI使能网络自动驾驶 AI Building Autonomous Driving Network
AI使能网络自动驾驶 AI Building Autonomous Driving Network
2.2 go在阿里云cdn系统的应用
2.2 go在阿里云cdn系统的应用
1.6 米嘉 gobuildweb
1.6 米嘉 gobuildweb
1.4 go在数据存储上面的应用—毛剑
1.4 go在数据存储上面的应用—毛剑
1.2 刘奇 go在分布式数据库中的应用
1.2 刘奇 go在分布式数据库中的应用
Protocol libraries the right way
Protocol libraries the right way
美团数据库运维平台介绍
美团数据库运维平台介绍
特卖场景下的大数据平台和机器学习实践
特卖场景下的大数据平台和机器学习实践
我的互联网运维理论与实践
我的互联网运维理论与实践
如何选择 Docker 监控方案
如何选择 Docker 监控方案
美团数据库运维平台介绍
美团数据库运维平台介绍
The net is dark and full of terrors - James Bennett
The net is dark and full of terrors - James Bennett
Hypothesis randomised testing for django
Hypothesis randomised testing for django
NoSQL@VIP — 唯品会NoSQL平台⾃动化发展及运维经验分享
NoSQL@VIP — 唯品会NoSQL平台⾃动化发展及运维经验分享
Py + gi 高效 c 庫整合方案
1.
Py + GI ⾼高效
C 庫整合⽅方案 Derek 呆
2.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! ● Derek 呆 ○ dailidu@linuxdeepin.com ○ daiderek@gmail.com ● 來⾃自 Linux Deepin ● 慣 C ● 愛 Python ● 搞 BASH ● 編 Linux System Program
3.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! Python <= (Binding) => C
4.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! ⼿手寫, 費時, 易出錯, 重複造輪
5.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 想⽤用⼯工具代勞?
6.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 試試 PyGObject
7.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 基於 GObject Introspection (GI)
8.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 與 Python 間只有少量整合代碼
9.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! ⾃自源代碼⽣生成 Type Library
10.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 包含 Version, Function Signature, Type Information, ...
11.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 可於多語⾔言間共⽤用
12.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! Runtime 時配合 libffi 進⾏行調⽤用
13.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 易於將成果推送到 Upstream
14.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 準備⼯工作 $ apt-get install build-essential gobject-introspection python-gobject libglib2.0-dev gtk-doc-tools
15.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 1 /* mylib.h */ #ifndef __MYLIB_H_ #define __MYLIB_H_ void hello(); #endif /* __MYLIB_H_ */
16.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 1 /* mylib.c */ #include "mylib.h" #include <stdio.h> void hello() { printf("hellon"); }
17.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 1 $ gcc -o libmylib.so -share … $ g-ir-scanner -o MyLib-1.0.gir -lmylib -L. mylib.h … $ g-ir-compiler MyLib-1.0.gir >MyLib-1.0.typelib
18.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 1 ... <namespace name="MyLib" version="1.0" shared-library="libmylib.so" c:identifier-prefixes="MyLib" c:symbol-prefixes="my_lib"> <function name="hello" c:identifier="hello"> <return-value transfer-ownership="none"> <type name="none" c:type="void"/> </return-value> </function> </namespace> ...
19.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 1 $ python -c 'from gi.repository import MyLib; MyLib.hello()' hello
20.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 資源管理是 Binding 開發⼀一⼤大重點
21.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 否則 Resource Leaking, Double Free, Invalid FD, Bus Error, Segfault...
22.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 2 /* mylib.h */ #ifndef __MYLIB_H_ #define __MYLIB_H_ const char * hello3(); char * hello2(); #endif /* __MYLIB_H_ */
23.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 2 /* mylib.c */ #include "mylib.h" #include <stdio.h> #include <string.h> const char * hello3() { return "hello"; } char * hello2() { return strdup("hello"); }
24.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 2 ... <function name="hello2" c:identifier="hello2"> <return-value transfer-ownership="full"> <type name="utf8" c:type="char*"/> </return-value> </function> <function name="hello3" c:identifier="hello3"> <return-value transfer-ownership="none"> <type name="utf8" c:type="const char*"/> </return-value> </function> ...
25.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 2 $ python -c 'from gi.repository import MyLib; print MyLib.hello2(); print MyLib.hello3()' hello hello
26.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! GI 有默認資源管理策略
27.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 但可通過 Annotation 改變
28.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 3 #ifndef __MYLIB_H_ #define __MYLIB_H_ /** * hello4: * Returns: (transfer full): */ const char * hello4(); #endif /* __MYLIB_H_ */
29.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 3 #include "mylib.h" #include <stdio.h> const char * hello4() { return "hello"; }
30.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 3 python -c 'from gi.repository import MyLib; print MyLib.hello4()' *** Error in `python': munmap_chunk(): invalid pointer: 0x00007f4503efd65d *** Aborted
31.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! Out 參數能處理嗎?
32.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 4 /** * hello5: * * @msg: (out callee-allocates): */ void hello5(char **msg);
33.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 4 void hello5(char **msg) { *msg = strdup("hello"); }
34.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 4 $ python -c 'from gi.repository import MyLib; print MyLib.hello5()' hello
35.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! Out 參數會以 Return Value呈現
36.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! Struct ⼜又如何?
37.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! ⼀一個 Type 需加上 4 個 Functions
38.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 基本也可以⼯工具產⽣生
39.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 5 #include <glib-object.h> #define TYPE_MY_OBJ (my_obj_get_type()) typedef struct _MyObj MyObj; MyObj my_obj_new(); GType my_obj_get_type();
40.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 5 struct _MyObj { int v; }; MyObj * my_obj_new() { return malloc(sizeof(MyObj)); }
41.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 5 MyObj * _my_obj_copy(MyObj *self) { MyObj *new_self = my_obj_new(); *new_self = *self; return new_self; }
42.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 5 void _my_obj_free(MyObj *self) { free(self); }
43.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 5 GType my_obj_get_type() { static GType type = 0; if(! type) { type = g_boxed_type_register_static( "MyObj", (GBoxedCopyFunc) _my_obj_copy, (GBoxedFreeFunc) _my_obj_free); } return type; }
44.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 例 5 $ python >>> from gi.repository import MyLib >>> o = MyLib.MyObj() >>> o <MyObj at 0x27d39c0> >>> o.copy() <MyObj at 0x2a7b7e0> >>> o = None >>>
45.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 還有⽀支持不了的類型嗎?
46.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! Variadic Function
47.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! ⼀一些資源 ● 完整內容 ● git repository ● Annotation 參考
48.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic! 廣告時間 ● Linux Deepin, 專注桌⾯面體驗的桌⾯面系統 ● 深之度公司⽂文化 ○ 低調, 做好實事 ○ ⽀支持開源⼈人, 做想做的開源事 ○ 週五 Hacking Day 讓你 Hack ⾃自我 ● 總部位於武漢 ● 提供遠程⼯工作機會等你來挑戰
49.
北京/上海/⼲⼴广州 0xFF Life's
pathetic, go Pythonic!
Download now