MCPcopy Create free account
hub / github.com/numpy/numpy / generate_def

Function generate_def

numpy/distutils/mingw32ccompiler.py:224–254  ·  view source on GitHub ↗

Given a dll file location, get all its exported symbols and dump them into the given def file. The .def file will be overwritten

(dll, dfile)

Source from the content-addressed store, hash-verified

222 return st.split(b'\n')
223
224def generate_def(dll, dfile):
225 """Given a dll file location, get all its exported symbols and dump them
226 into the given def file.
227
228 The .def file will be overwritten"""
229 dump = dump_table(dll)
230 for i in range(len(dump)):
231 if _START.match(dump[i].decode()):
232 break
233 else:
234 raise ValueError("Symbol table not found")
235
236 syms = []
237 for j in range(i+1, len(dump)):
238 m = _TABLE.match(dump[j].decode())
239 if m:
240 syms.append((int(m.group(1).strip()), m.group(2)))
241 else:
242 break
243
244 if len(syms) == 0:
245 log.warn('No symbols found in %s' % dll)
246
247 with open(dfile, 'w') as d:
248 d.write('LIBRARY %s\n' % os.path.basename(dll))
249 d.write(';CODE PRELOAD MOVEABLE DISCARDABLE\n')
250 d.write(';DATA PRELOAD SINGLE\n')
251 d.write('\nEXPORTS\n')
252 for s in syms:
253 #d.write('@%d %s\n' % (s[0], s[1]))
254 d.write('%s\n' % s[1])
255
256def find_dll(dll_name):
257

Callers 2

build_msvcr_libraryFunction · 0.85

Calls 6

dump_tableFunction · 0.85
openFunction · 0.85
decodeMethod · 0.80
stripMethod · 0.80
warnMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected