Posted to tcl by patthoyts at Thu Aug 31 14:32:54 GMT 2006view raw

  1. # stdcall.sed - Copyright (C) 2006 Pat Thoyts <patthoyts@users.sourceforge.net>
  2. #
  3. # Create DEF file for a stdcall API that can be linked using gcc.
  4. # Gcc expects to decorate stdcall functions with @NN where NN is the size
  5. # in bytes of the parameters on the stack. Mingw's pexports utility can
  6. # provide this correctly if it is given the API header file but we must also
  7. # provide undecorated aliases for use by the linker. This script sorts this
  8. #
  9. # usage:
  10. # pexports -h cryptlib.h cl32.dll | sed -f stdcall.sed > crypt32.def
  11. # dlltool -k -D cl32 -d crypt32.def -l libcl32.a
  12. #
  13. ${
  14. G
  15. }
  16. /^[ ]*$/d
  17. /EXPORTS/,${
  18. /@/{
  19. p
  20. s/[ ]*\(.*\)@\([0-9][0-9]*\)/\1@\2=\1/
  21. H
  22. d
  23. }
  24. }
  25.  
  26.