-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* dot -Tpng call_stack.dot -o call_stack.png | ||
* tlming16 | ||
* all wrongs reserved | ||
*/ | ||
digraph compile { | ||
edge [fontname="FangSong"]; | ||
node [shape=box, fontname="FangSong" size="20,20"]; | ||
a[label="函数参数,\n rdi,rsi,rdx,rcx,r8,r9 \n 参数个数多余6个 \n 顺序\n nth\n ...\n 8th\n 7th"]; | ||
b[label="函数返回地址\n "]; | ||
c[label="上一帧栈%rbp地址\n push %rbp \n movq %rsp,%rbp"]; | ||
d[label="局部变量地址\n 起始地址为-n(%rbp) n为第一个变量的size\n 注意内存对齐"]; | ||
e[label="---"]; | ||
f[label="%esp 地址"]; | ||
a->b; | ||
b->c; | ||
c->d; | ||
d->e; | ||
e->f; | ||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# mysql (https://www.cnblogs.com/sfencs-hcy/p/9769505.html) | ||
|
||
- my.ini | ||
|
||
``` | ||
[mysql] | ||
# 设置mysql客户端默认字符集 | ||
default-character-set=utf8 | ||
[mysqld] | ||
#设置3306端口 | ||
bind-address = 0.0.0.0 | ||
port = 3306 | ||
skip_grant_tables | ||
# 设置mysql的安装目录 | ||
basedir=D:\\Applications\\mysql-8.0.21-winx64 | ||
# 设置mysql数据库的数据的存放目录 | ||
datadir=D:\\Applications\\mysql-8.0.21-winx64\\data | ||
# 允许最大连接数 | ||
max_connections=200 | ||
# 服务端使用的字符集默认为8比特编码的latin1字符集 | ||
character-set-server=utf8 | ||
# 创建新表时将使用的默认存储引擎 | ||
default-storage-engine=INNODB | ||
``` | ||
|
||
- mysqld --initialize --console | ||
|
||
- 记住密码 | ||
- mysqld --install mysql | ||
- net start mysql | ||
- mysql -uroot -p | ||
|
||
- 密码 | ||
- 改密码 | ||
- ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码'; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// gcc -shared -fPIC -o libexample.dll example.c | ||
|
||
int add(int x,int y){ | ||
return x+y; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env python3 | ||
# coding:utf-8 | ||
from ctypes import * | ||
if __name__ =='__main__': | ||
lib_name ="./libexample.dll" | ||
lib= cdll.LoadLibrary(lib_name) | ||
print(lib.add(c_int(10),c_int(10))); |
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# python 调用 C语言动态库 | ||
|
||
- c语言编写基本函数,打包成动态链接库 | ||
- 依赖 ctypes 引入动态库 | ||
|
||
# c代码 | ||
|
||
```c | ||
// example.c | ||
//gcc -shared -fPIC -o libexample.dll example.c | ||
int add(int x,int y){ | ||
return x+y; | ||
} | ||
``` | ||
# 编译 | ||
``` | ||
gcc -shared -fPIC -o libexample.dll example.c | ||
``` | ||
# python 调用 | ||
```python | ||
#!/usr/bin/env python3 | ||
# coding:utf-8 | ||
from ctypes import * | ||
if __name__ =='__main__': | ||
lib_name ="./libexample.dll" | ||
lib= cdll.LoadLibrary(lib_name) | ||
print(lib.add(c_int(10),c_int(10))); | ||
``` | ||
|