Mercurial > pub > dyncall > bindings
view python/pydc/examples/atoi.py @ 0:0cfcc391201f
initial from svn dyncall-1745
author | Daniel Adler |
---|---|
date | Thu, 19 Mar 2015 22:26:28 +0100 |
parents | |
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"]) )