win32/mkexports.rb
DEFINITIONS
This source file includes following functions.
1 #!./miniruby -s
2
3 SYM = {}
4
5 objs = ARGV.collect {|s| s.tr('/', '\\')}
6 IO.foreach("|dumpbin -symbols " + objs.join(' ')) do |l|
7 next if /^[0-9A-F]+ 0+ UNDEF / =~ l
8 next unless l.sub!(/.*\sExternal\s+\|\s+/, '')
9 if l.sub!(/^_/, '')
10 next if /@.*@/ =~ l || /@[0-9a-f]{16}$/ =~ l
11 elsif !l.sub!(/^(\S+) \([^@?\`\']*\)$/, '\1')
12 next
13 end
14 SYM[l.strip] = true
15 end
16
17 exports = []
18 if $name
19 exports << "Name " + $name
20 elsif $library
21 exports << "Library " + $library
22 end
23 exports << "Description " + $description.dump if $description
24 exports << "EXPORTS" << SYM.keys.sort
25
26 if $output
27 open($output, 'w') {|f| f.puts exports.join("\n")}
28 else
29 puts exports.join("\n")
30 end