Last active
April 27, 2022 04:31
-
-
Save soda92/0ad09035264e29e9c0275f6e06d3e765 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
gcc -c -Wall -Werror -fPIC lib.c | |
gcc -shared -o lib.dll lib.o |
This file contains hidden or 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
int a[8]={1, 2, 1, 2, 1, 2, 1, 2}; |
This file contains hidden or 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
from ctypes import * | |
int8p = c_int * 8 | |
dll = CDLL("./lib.dll") | |
val = int8p.in_dll(dll, "a") | |
for i in val: | |
print(i, end=" ") | |
print() | |
val[0] = 10 | |
for i in val: | |
print(i, end=" ") | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment