mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 12:32:21 +00:00
ch2-07: 例子完善
This commit is contained in:
parent
f097efc195
commit
6c1741df63
@ -3,6 +3,9 @@ default:
|
||||
gcc -Wall _test_so.c ./say-hello.so
|
||||
./a.out
|
||||
|
||||
run-py3:
|
||||
python3 hello.py
|
||||
|
||||
clean:
|
||||
-rm *.so
|
||||
-rm *.out
|
||||
|
9
examples/ch2-07/hello-so/hello.py
Normal file
9
examples/ch2-07/hello-so/hello.py
Normal file
@ -0,0 +1,9 @@
|
||||
from ctypes import *
|
||||
|
||||
libso = CDLL("./say-hello.so")
|
||||
|
||||
SayHello = libso.SayHello
|
||||
SayHello.argtypes = [c_char_p]
|
||||
SayHello.restype = None
|
||||
|
||||
SayHello(c_char_p(b"hello"))
|
Loading…
x
Reference in New Issue
Block a user