Mercurial > pub > dyncall > bindings
annotate 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 |
rev | line source |
---|---|
0 | 1 from pydc import * |
2 from sys import platform | |
3 | |
4 if platform == "win32": | |
5 libc = load("msvcrt") | |
6 elif platform == "darwin": | |
7 libc = load("/usr/lib/libc.dylib") | |
8 else: | |
9 libc = load("/lib/libc.so.6") | |
10 | |
11 fp_atoi = find(libc,"atoi") | |
12 fp_atof = find(libc,"atof") | |
13 | |
14 def atoi(s): return call(fp_atoi,"p)i",s) | |
15 def atod(s): return call(fp_atof,"p)d",s) | |
16 | |
17 print atoi( "3".join(["12","45"]) ) | |
18 print atod( "3".join(["12","45"]) ) | |
19 |