(lib=PYTHONLIB,types=('T','C','D'))
| 41 | NM = 'nm -p -g %s' # For Linux, use "nm -g %s" |
| 42 | |
| 43 | def symbols(lib=PYTHONLIB,types=('T','C','D')): |
| 44 | |
| 45 | with os.popen(NM % lib) as pipe: |
| 46 | lines = pipe.readlines() |
| 47 | lines = [s.strip() for s in lines] |
| 48 | symbols = {} |
| 49 | for line in lines: |
| 50 | if len(line) == 0 or ':' in line: |
| 51 | continue |
| 52 | items = line.split() |
| 53 | if len(items) != 3: |
| 54 | continue |
| 55 | address, type, name = items |
| 56 | if type not in types: |
| 57 | continue |
| 58 | symbols[name] = address,type |
| 59 | return symbols |
| 60 | |
| 61 | def export_list(symbols): |
| 62 |