Mercurial > pub > dyncall > bindings
diff python/pydc/examples/atoi.py @ 5:bf5625bb6f05
- brought python binding up to dc v0.9
author | cslag |
---|---|
date | Tue, 22 Mar 2016 01:49:34 +0100 |
parents | 0cfcc391201f |
children | edbbd467f50a |
line wrap: on
line diff
--- a/python/pydc/examples/atoi.py Tue Mar 22 00:55:15 2016 +0100 +++ b/python/pydc/examples/atoi.py Tue Mar 22 01:49:34 2016 +0100 @@ -1,16 +1,23 @@ from pydc import * -from sys import platform +import sys +import platform -if platform == "win32": +if sys.platform == "win32": libc = load("msvcrt") -elif platform == "darwin": +elif sys.platform == "darwin": libc = load("/usr/lib/libc.dylib") +elif "bsd" in sys.platform: + libc = load("/usr/lib/libc.so") +elif platform.architecture()[0] == "64bit": + libc = load("/lib64/libc.so.6") else: libc = load("/lib/libc.so.6") fp_atoi = find(libc,"atoi") fp_atof = find(libc,"atof") + + def atoi(s): return call(fp_atoi,"p)i",s) def atod(s): return call(fp_atof,"p)d",s)