Mercurial > pub > dyncall > bindings
view python/pydc/examples/atoi.py @ 3:f5d4d5c2f750
- gemspec fix
author | cslag |
---|---|
date | Thu, 31 Dec 2015 20:24:53 +0100 |
parents | 0cfcc391201f |
children | bf5625bb6f05 |
line wrap: on
line source
from pydc import * from sys import platform if platform == "win32": libc = load("msvcrt") elif platform == "darwin": libc = load("/usr/lib/libc.dylib") 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) print atoi( "3".join(["12","45"]) ) print atod( "3".join(["12","45"]) )