code: def generate_def(dll, dfile):
      """Given a dll file location,  get all its exported symbols and dump them
      into the given def file.
  
      The .def file will be overwritten"""
      dump = dump_table(dll)
      for i in range(len(dump)):
          if _START.match(dump[i].decode()):
              break
      else:
          raise ValueError("Symbol table not found")
  
      syms = []
      for j in range(i + 1, len(dump)):
          m = _TABLE.match(dump[j].decode())
          if m:
              syms.append((int(m.group(1).strip()), m.group(2)))
          else:
              break
  
      if len(syms) == 0:
          log.warn("No symbols found in %s" % dll)
  
      d = open(dfile, "w")
      d.write("LIBRARY        %s\n" % os.path.basename(dll))
      d.write(";CODE          PRELOAD MOVEABLE DISCARDABLE\n")
      d.write(";DATA          PRELOAD SINGLE\n")
      d.write("\nEXPORTS\n")
      for s in syms:
          # d.write('@%d    %s\n' % (s[0], s[1]))
          d.write("%s\n" % s[1])
      d.close()
  
imports: from __future__ import division, absolute_import, print_function
  import os
  import sys
  import subprocess
  import re
  import numpy.distutils.ccompiler
  import distutils.cygwinccompiler
  from distutils.version import StrictVersion
  from numpy.distutils.ccompiler import gen_preprocess_options, gen_lib_options
  from distutils.unixccompiler import UnixCCompiler
  from distutils.msvccompiler import get_build_version
  from distutils.errors import DistutilsExecError, CompileError, UnknownFileError
  from numpy.distutils.misc_util import msvc_runtime_library, msvc_runtime_version, msvc_runtime_major, get_build_architecture
label_desc: Use image node_id 4 for calling a global function with example usage: generate_def(dll, dfile) without return types