Mercurial > pub > dyncall > bindings
view python/pydc/examples/atoi.py @ 4:4c5019f00f5b
- python binding cleanup
author | cslag |
---|---|
date | Tue, 22 Mar 2016 00:55:15 +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"]) )