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

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