DLL生成lib
来源:互联网 发布:网络个人信息安全论文 编辑:程序博客网 时间:2024/05/16 18:41
import sysimport osimport os.pathimport globdef genLib(dllpath, arch, outdir): dirname = os.path.dirname(dllpath) dllname = os.path.basename(dllpath).split(".")[0] deftemp = "%s/%s_temp.temp"%(dirname, dllname) defout = "%s/%s.def"%(dirname, dllname) if outdir == "": outdir = dirname if deftemp[0] == "/": deftemp = deftemp[1:] defout = defout[1:] defcmd = "dumpbin %s /exports /out:%s"%(dllpath, deftemp) print defcmd os.system(defcmd) f_temp = open(deftemp, "r") f_out = open(defout, "wb") f_out.write("LIBRARY %s\n"%(dllname)) f_out.write("EXPORTS\n") begin = False for line in f_temp: line_s = line.strip().split() if len(line_s) < 1: continue if line_s[0] == "ordinal": begin = True continue if line_s[0] == "Summary": begin = False break if begin == True: f_out.write("\t%s\n"%(line_s[3])) #print "line_s:%s"%line_s[0] f_out.close() f_temp.close() os.remove(deftemp) outlib = "%s/%s.lib"%(outdir, dllname) if outlib[0] == "/": outlib = outlib[1:] libcmd = "lib /def:%s /MACHINE:%s /out:%s"%(defout, arch, outlib) print libcmd os.system(libcmd)#需要先通过VS2010的快捷键切换到cmd下设置好环境变量if __name__ == "__main__": wildcard = sys.argv[1] arch = "X86" if len(sys.argv) > 2: arch = sys.argv[2] outdir = "" if len(sys.argv) > 3: outdir = sys.argv[3] if not os.path.exists(outdir) and outdir != "": os.makedirs(outdir) names = glob.glob(wildcard) for dllpath in names: genLib(dllpath, arch, outdir)
0 0
- 从dll生成lib
- dll 生成 lib
- 从DLL生成LIB
- dll生成lib文件
- 从dll生成.lib
- 通过dll生成lib
- DLL生成lib
- dll生成lib
- 生成LIB和DLL方法
- 利用DLL生成lib文件
- dll文件生成.lib文件
- 由DLL生成LIB文件
- QT生成dll和lib
- vs2015 生成dll和lib
- DLL生成DEF,DEF生成LIB
- VS2013 生成dll事,没有lib生成
- VC++中生成DLL和LIB文件
- 如何从DLL中生成LIB文件
- oracle命令
- 在js中怎样捕获css3动画事件
- 分类器
- ros调试
- 男神金秀贤令万千粉丝中“星星毒”
- DLL生成lib
- NSTableView的使用例子
- ADO参考, 各种连接数据库字符串
- MVC二级联动使用$.getJSON方法
- liferay之使用iframe
- oracle expdp导出 去除表统计信息
- JAVA操作数据库的一个通用类
- Oracle 如何修改列不为空的时候的数据类型
- 游戏服务器技术