Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added dead simple ctypes example

  • Loading branch information...
commit 57e6d6fa003e2878e633a98054aa69531ef44594 1 parent f067550
@hammer authored
Showing with 17 additions and 0 deletions.
  1. +10 −0 ctypes/example1/README.md
  2. +7 −0 ctypes/example1/hello.c
View
10 ctypes/example1/README.md
@@ -0,0 +1,10 @@
+To build the shared library on Mac OS X:
+
+ $ gcc -shared -Wl,-install_name,hello.so -o hello.so -fPIC hello.c
+
+
+To use:
+
+ >>> import ctypes
+ >>> hello = ctypes.CDLL('hello.so')
+ >>> hello.myprint()
View
7 ctypes/example1/hello.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void myprint(void);
+
+void myprint() {
+ printf("hello world\n");
+}
Please sign in to comment.
Something went wrong with that request. Please try again.