blob: 55c02854428be9097c4e700fb665e6f6acfe0413 [file] [log] [blame]
Jakub Adam47d338c2019-07-26 18:49:49 +02001#!/usr/bin/env python3
2#
3# gen-def.py usrsctp.lib
4import re
5import sys
6import subprocess
7from shutil import which
8
9try:
10 lib_file = sys.argv[1]
11except:
12 print('Usage: gen-def.py LIB-FILE')
13 exit(-1)
14
15print('EXPORTS')
16
17if which('dumpbin'):
18 dumpbin_cmd = subprocess.run(['dumpbin', '/linkermember:1', lib_file],
19 stdout=subprocess.PIPE)
20
21 pattern = re.compile('\s*[0-9a-fA-F]+ _?(?P<functionname>usrsctp_[^\s]*)')
22
23 for line in dumpbin_cmd.stdout.decode('utf-8').splitlines():
24 match = pattern.match(line)
25 if match:
26 print(match.group('functionname'))