Skip to content

Instantly share code, notes, and snippets.

@soda92
Last active April 27, 2022 04:31
Show Gist options
  • Save soda92/0ad09035264e29e9c0275f6e06d3e765 to your computer and use it in GitHub Desktop.
Save soda92/0ad09035264e29e9c0275f6e06d3e765 to your computer and use it in GitHub Desktop.
gcc -c -Wall -Werror -fPIC lib.c
gcc -shared -o lib.dll lib.o
int a[8]={1, 2, 1, 2, 1, 2, 1, 2};
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