create-windef.pl 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/perl -w
  2. use strict;
  3. my $outfile = shift || usage ();
  4. my $soname = shift || usage ();
  5. my $dllname = shift || usage ();
  6. my @symbols = ();
  7. my %excludes = ();
  8. my $cmd = "nm -D $soname";
  9. @excludes {qw(
  10. mono_class_setup_vtable_general_new mono_debugger_init mono_debugger_main
  11. mono_once mono_pthread_key_for_tls
  12. mono_gc_pthread_create mono_gc_pthread_detach mono_gc_pthread_join
  13. mono_gc_pthread_exit
  14. mono_file_map_fileio mono_file_unmap_fileio
  15. mono_file_map_set_allocator
  16. )} = ();
  17. open (SYMS, "$cmd |") || die "Cannot run \$cmd': $!\n";
  18. while (<SYMS>) {
  19. next unless / T (mono_.*)/;
  20. next if exists $excludes {$1};
  21. push @symbols, $1;
  22. }
  23. close (SYMS);
  24. push @symbols, "MonoFixupCorEE";
  25. @symbols = sort @symbols;
  26. open (OUT, ">$outfile") || die "Cannot open '$outfile': $!\n";
  27. print OUT "; file generated by create-windef.pl\n";
  28. print OUT "LIBRARY $dllname\nEXPORTS\n";
  29. print OUT join ("\n", @symbols);
  30. print OUT "\n";
  31. close (OUT);
  32. sub usage {
  33. print "Usage: create-windef.pl output_file soname dllname\n";
  34. exit (1);
  35. }