Attachment 'a2lib.py'
Download 1 import os,re,sys,shutil
2 from os.path import join, getsize
3 from subprocess import Popen, PIPE
4 os.environ['PATH'] = os.environ['PATH'] + ";C:\\Program Files\\Microsoft Visual Studio 9.0\\Common7\\IDE\\;C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\bin\\;C:\\MinGW\\bin"
5 root = "C:\\obs\\usr\\i686-w64-mingw32\\sys-root\\mingw"
6
7 def gen(dll,lib,d):
8 output = Popen(["nm", lib], stdout=PIPE).communicate()[0]
9 with open(d, "wb") as f:
10 f.write(b"EXPORTS\n")
11 for line in output.split(b"\r\n"):
12 if (re.match(b".* T _|.* I __nm", line)): #|.* I __imp
13 line = re.sub(b"^.* T _|^.* I __nm__", b"", line) #|^.* I _
14 f.write(line + b"\n")
15 f.write(str.encode("LIBRARY %s\n" % dll))
16 p = Popen(["lib", "/def:%s" % d]) #, shell = True)
17
18 os.chdir(root + "\\lib")
19 for root, dirs, files in os.walk(root + "\\bin"):
20 for f in files:
21 if (re.search(".dll", f)):
22 name = re.sub("^lib", "", f)
23 name = re.sub("(?:-\\d).dll", "", name)
24 print("Working on %s\n" % f)
25 d = "%s.def" % name
26 lib = "lib%s.dll.a" % name
27 gen(f, lib, d)
28
29 gen("msvcrt.dll", "libmsvcrt.a", "libmsvcrt.def")
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.