Support for generation of .def files from .spec files.

diff --git a/Make.rules.in b/Make.rules.in
index 8cfe6d3..25fb0d7 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -92,7 +92,7 @@
 conf_manext     = 5
 includedir      = @includedir@/wine
 CLEAN_FILES     = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
-                  *.flc *.spec.c *.glue.c y.tab.c y.tab.h lex.yy.c core
+                  *.flc *.spec.c *.spec.def *.glue.c y.tab.c y.tab.h lex.yy.c core
 
 OBJS = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
        $(ASM_SRCS:.S=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
@@ -101,7 +101,7 @@
 
 # Implicit rules
 
-.SUFFIXES: .mc .rc .mc.rc .res .spec .spec.c .glue.c .pl .ok
+.SUFFIXES: .mc .rc .mc.rc .res .spec .spec.c .spec.def .glue.c .pl .ok
 
 .c.o:
 	$(CC) -c $(ALLCFLAGS) -o $@ $<
@@ -121,6 +121,9 @@
 .spec.spec.c:
 	$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L$(DLLDIR) -o $@ -spec $<
 
+.spec.spec.def:
+	$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L$(DLLDIR) -o $@ -def $<
+
 .c.glue.c:
 	$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -glue $<
 
@@ -254,6 +257,8 @@
 
 $(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD)
 
+$(SPEC_SRCS:.spec=.spec.def): $(WINEBUILD)
+
 $(GLUE:.c=.glue.c): $(WINEBUILD)
 
 $(RC_SRCS:.rc=.res): $(WRC)
diff --git a/configure b/configure
index a43d35a..ae2c9a3 100755
--- a/configure
+++ b/configure
@@ -5174,8 +5174,58 @@
 fi
 
 
+echo $ac_n "checking whether stdcall symbols need to be decorated""... $ac_c" 1>&6
+echo "configure:5179: checking whether stdcall symbols need to be decorated" >&5
+if eval "test \"`echo '$''{'ac_cv_c_stdcall_decoration'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  saved_libs=$LIBS
+LIBS="conftest_asm.s $LIBS"
+if test "$ac_cv_c_extern_prefix" = "yes"
+then
+cat > conftest_asm.s <<EOF
+	.globl _ac_test@0
+_ac_test@0:
+EOF
+else
+cat > conftest_asm.s <<EOF
+	.globl ac_test@0
+ac_test@0:
+EOF
+fi
+cat > conftest.$ac_ext <<EOF
+#line 5198 "configure"
+#include "confdefs.h"
+extern void __attribute__((__stdcall__)) ac_test(void);
+int main() {
+ac_test(); return 0
+; return 0; }
+EOF
+if { (eval echo configure:5205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_cv_c_stdcall_decoration="yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_stdcall_decoration="no"
+fi
+rm -f conftest*
+LIBS=$saved_libs
+fi
+
+echo "$ac_t""$ac_cv_c_stdcall_decoration" 1>&6
+if test "$ac_cv_c_stdcall_decoration" = "yes"
+then
+  cat >> confdefs.h <<\EOF
+#define NEED_STDCALL_DECORATION 1
+EOF
+
+fi
+
+
 echo $ac_n "checking whether assembler accepts .string""... $ac_c" 1>&6
-echo "configure:5179: checking whether assembler accepts .string" >&5
+echo "configure:5229: checking whether assembler accepts .string" >&5
 if eval "test \"`echo '$''{'ac_cv_c_asm_string'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5185,14 +5235,14 @@
 	.string "test"
 EOF
 cat > conftest.$ac_ext <<EOF
-#line 5189 "configure"
+#line 5239 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_c_asm_string="yes"
 else
@@ -5220,21 +5270,21 @@
 if test "$LIBEXT" = "so"
 then
   echo $ac_n "checking whether we can build a GNU style ELF dll""... $ac_c" 1>&6
-echo "configure:5224: checking whether we can build a GNU style ELF dll" >&5
+echo "configure:5274: checking whether we can build a GNU style ELF dll" >&5
 if eval "test \"`echo '$''{'ac_cv_c_dll_gnuelf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   saved_cflags=$CFLAGS
   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0,-Bsymbolic"
   cat > conftest.$ac_ext <<EOF
-#line 5231 "configure"
+#line 5281 "configure"
 #include "confdefs.h"
 
 int main() {
 return 1
 ; return 0; }
 EOF
-if { (eval echo configure:5238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_c_dll_gnuelf="yes"
 else
@@ -5255,21 +5305,21 @@
     LDDLLFLAGS="-Wl,-Bsymbolic"
   else
     echo $ac_n "checking whether we can build a UnixWare (Solaris) dll""... $ac_c" 1>&6
-echo "configure:5259: checking whether we can build a UnixWare (Solaris) dll" >&5
+echo "configure:5309: checking whether we can build a UnixWare (Solaris) dll" >&5
 if eval "test \"`echo '$''{'ac_cv_c_dll_unixware'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   saved_cflags=$CFLAGS
     CFLAGS="$CFLAGS -fPIC -Wl,-G,-h,conftest.so.1.0,-B,symbolic"
     cat > conftest.$ac_ext <<EOF
-#line 5266 "configure"
+#line 5316 "configure"
 #include "confdefs.h"
 
 int main() {
 return 1
 ; return 0; }
 EOF
-if { (eval echo configure:5273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_c_dll_unixware="yes"
 else
@@ -5333,7 +5383,7 @@
 wine_cv_libc_reentrant=no 
 
   echo $ac_n "checking for reentrant libc: __errno_location""... $ac_c" 1>&6
-echo "configure:5337: checking for reentrant libc: __errno_location" >&5
+echo "configure:5387: checking for reentrant libc: __errno_location" >&5
 if eval "test \"`echo '$''{'wine_cv_libc_r___errno_location'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5341,14 +5391,14 @@
   wine_cv_libc_r___errno_location=yes 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5345 "configure"
+#line 5395 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
 int *__errno_location(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 EOF
-if { (eval echo configure:5352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   wine_cv_libc_r___errno_location=yes
 else
@@ -5371,7 +5421,7 @@
 
 
   echo $ac_n "checking for reentrant libc: __error""... $ac_c" 1>&6
-echo "configure:5375: checking for reentrant libc: __error" >&5
+echo "configure:5425: checking for reentrant libc: __error" >&5
 if eval "test \"`echo '$''{'wine_cv_libc_r___error'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5379,14 +5429,14 @@
   wine_cv_libc_r___error=yes 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5383 "configure"
+#line 5433 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
 int *__error(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 EOF
-if { (eval echo configure:5390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   wine_cv_libc_r___error=yes
 else
@@ -5409,7 +5459,7 @@
 
 
   echo $ac_n "checking for reentrant libc: ___errno""... $ac_c" 1>&6
-echo "configure:5413: checking for reentrant libc: ___errno" >&5
+echo "configure:5463: checking for reentrant libc: ___errno" >&5
 if eval "test \"`echo '$''{'wine_cv_libc_r____errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5417,14 +5467,14 @@
   wine_cv_libc_r____errno=yes 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5421 "configure"
+#line 5471 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
 int *___errno(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 EOF
-if { (eval echo configure:5428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   wine_cv_libc_r____errno=yes
 else
@@ -5447,7 +5497,7 @@
 
 
   echo $ac_n "checking for reentrant libc: __thr_errno""... $ac_c" 1>&6
-echo "configure:5451: checking for reentrant libc: __thr_errno" >&5
+echo "configure:5501: checking for reentrant libc: __thr_errno" >&5
 if eval "test \"`echo '$''{'wine_cv_libc_r___thr_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5455,14 +5505,14 @@
   wine_cv_libc_r___thr_errno=yes 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5459 "configure"
+#line 5509 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
 int *__thr_errno(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 EOF
-if { (eval echo configure:5466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   wine_cv_libc_r___thr_errno=yes
 else
@@ -5485,7 +5535,7 @@
 
 
   echo $ac_n "checking for reentrant libc: __errno""... $ac_c" 1>&6
-echo "configure:5489: checking for reentrant libc: __errno" >&5
+echo "configure:5539: checking for reentrant libc: __errno" >&5
 if eval "test \"`echo '$''{'wine_cv_libc_r___errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5493,14 +5543,14 @@
   wine_cv_libc_r___errno=yes 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5497 "configure"
+#line 5547 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
 int *__errno(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 EOF
-if { (eval echo configure:5504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   wine_cv_libc_r___errno=yes
 else
@@ -5534,7 +5584,7 @@
 if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
 then
 echo $ac_n "checking for reentrant X libraries""... $ac_c" 1>&6
-echo "configure:5538: checking for reentrant X libraries" >&5
+echo "configure:5588: checking for reentrant X libraries" >&5
 if eval "test \"`echo '$''{'wine_cv_x_reentrant'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5583,19 +5633,19 @@
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:5587: checking for working alloca.h" >&5
+echo "configure:5637: checking for working alloca.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5592 "configure"
+#line 5642 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:5599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -5616,12 +5666,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:5620: checking for alloca" >&5
+echo "configure:5670: checking for alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5625 "configure"
+#line 5675 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -5649,7 +5699,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:5653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -5681,12 +5731,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:5685: checking whether alloca needs Cray hooks" >&5
+echo "configure:5735: checking whether alloca needs Cray hooks" >&5
 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5690 "configure"
+#line 5740 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -5711,12 +5761,12 @@
 if test $ac_cv_os_cray = yes; then
 for ac_func in _getb67 GETB67 getb67; do
   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5715: checking for $ac_func" >&5
+echo "configure:5765: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5720 "configure"
+#line 5770 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5739,7 +5789,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -5766,7 +5816,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:5770: checking stack direction for C alloca" >&5
+echo "configure:5820: checking stack direction for C alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5774,7 +5824,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 5778 "configure"
+#line 5828 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -5793,7 +5843,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:5797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_stack_direction=1
 else
@@ -5855,12 +5905,12 @@
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5859: checking for $ac_func" >&5
+echo "configure:5909: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5864 "configure"
+#line 5914 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5883,7 +5933,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -5967,17 +6017,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5971: checking for $ac_hdr" >&5
+echo "configure:6021: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5976 "configure"
+#line 6026 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5981: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6004,12 +6054,12 @@
 done
 
 echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:6008: checking whether stat file-mode macros are broken" >&5
+echo "configure:6058: checking whether stat file-mode macros are broken" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6013 "configure"
+#line 6063 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -6062,12 +6112,12 @@
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:6066: checking for working const" >&5
+echo "configure:6116: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6071 "configure"
+#line 6121 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -6116,7 +6166,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6170: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -6137,21 +6187,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:6141: checking for inline" >&5
+echo "configure:6191: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 6148 "configure"
+#line 6198 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:6155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6205: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -6177,12 +6227,12 @@
 esac
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:6181: checking for ANSI C header files" >&5
+echo "configure:6231: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6186 "configure"
+#line 6236 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -6190,7 +6240,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6194: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6244: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6207,7 +6257,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 6211 "configure"
+#line 6261 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -6225,7 +6275,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 6229 "configure"
+#line 6279 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -6246,7 +6296,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 6250 "configure"
+#line 6300 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -6257,7 +6307,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:6261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -6281,12 +6331,12 @@
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:6285: checking for size_t" >&5
+echo "configure:6335: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6290 "configure"
+#line 6340 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -6314,7 +6364,7 @@
 fi
 
 echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:6318: checking size of long long" >&5
+echo "configure:6368: checking size of long long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6322,7 +6372,7 @@
   ac_cv_sizeof_long_long=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 6326 "configure"
+#line 6376 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 #include <sys/types.h>
@@ -6334,7 +6384,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:6338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long_long=`cat conftestval`
 else
@@ -6355,12 +6405,12 @@
 
 
 echo $ac_n "checking whether linux/input.h is for real""... $ac_c" 1>&6
-echo "configure:6359: checking whether linux/input.h is for real" >&5
+echo "configure:6409: checking whether linux/input.h is for real" >&5
 if eval "test \"`echo '$''{'wine_cv_linux_input_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6364 "configure"
+#line 6414 "configure"
 #include "confdefs.h"
 
 	    #include <linux/input.h>
@@ -6373,7 +6423,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6377: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6427: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_linux_input_h=yes
 else
@@ -6397,12 +6447,12 @@
 
    
 echo $ac_n "checking whether we can use re-entrant gethostbyname_r Linux style""... $ac_c" 1>&6
-echo "configure:6401: checking whether we can use re-entrant gethostbyname_r Linux style" >&5
+echo "configure:6451: checking whether we can use re-entrant gethostbyname_r Linux style" >&5
 if eval "test \"`echo '$''{'wine_cv_linux_gethostbyname_r_6'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6406 "configure"
+#line 6456 "configure"
 #include "confdefs.h"
 
 #include <netdb.h>
@@ -6423,7 +6473,7 @@
     
 ; return 0; }
 EOF
-if { (eval echo configure:6427: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6477: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_linux_gethostbyname_r_6=yes
 else
@@ -6449,12 +6499,12 @@
 if test "$ac_cv_header_linux_joystick_h" = "yes"
 then
    echo $ac_n "checking whether linux/joystick.h uses the Linux 2.2+ API""... $ac_c" 1>&6
-echo "configure:6453: checking whether linux/joystick.h uses the Linux 2.2+ API" >&5
+echo "configure:6503: checking whether linux/joystick.h uses the Linux 2.2+ API" >&5
 if eval "test \"`echo '$''{'wine_cv_linux_joystick_22_api'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6458 "configure"
+#line 6508 "configure"
 #include "confdefs.h"
 
 	#include <sys/ioctl.h>
@@ -6469,7 +6519,7 @@
 /*empty*/
 ; return 0; }
 EOF
-if { (eval echo configure:6473: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6523: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_linux_joystick_22_api=yes
 else
@@ -6496,12 +6546,12 @@
 if test "$ac_cv_header_sys_vfs_h" = "yes"
 then
     echo $ac_n "checking whether sys/vfs.h defines statfs""... $ac_c" 1>&6
-echo "configure:6500: checking whether sys/vfs.h defines statfs" >&5
+echo "configure:6550: checking whether sys/vfs.h defines statfs" >&5
 if eval "test \"`echo '$''{'wine_cv_sys_vfs_has_statfs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6505 "configure"
+#line 6555 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -6518,7 +6568,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6522: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_sys_vfs_has_statfs=yes
 else
@@ -6545,12 +6595,12 @@
 if test "$ac_cv_header_sys_statfs_h" = "yes"
 then
     echo $ac_n "checking whether sys/statfs.h defines statfs""... $ac_c" 1>&6
-echo "configure:6549: checking whether sys/statfs.h defines statfs" >&5
+echo "configure:6599: checking whether sys/statfs.h defines statfs" >&5
 if eval "test \"`echo '$''{'wine_cv_sys_statfs_has_statfs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6554 "configure"
+#line 6604 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -6565,7 +6615,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6569: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_sys_statfs_has_statfs=yes
 else
@@ -6592,12 +6642,12 @@
 if test "$ac_cv_header_sys_mount_h" = "yes"
 then
     echo $ac_n "checking whether sys/mount.h defines statfs""... $ac_c" 1>&6
-echo "configure:6596: checking whether sys/mount.h defines statfs" >&5
+echo "configure:6646: checking whether sys/mount.h defines statfs" >&5
 if eval "test \"`echo '$''{'wine_cv_sys_mount_has_statfs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6601 "configure"
+#line 6651 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -6612,7 +6662,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6666: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_sys_mount_has_statfs=yes
 else
@@ -6638,7 +6688,7 @@
 
 
 echo $ac_n "checking for statfs.f_bfree""... $ac_c" 1>&6
-echo "configure:6642: checking for statfs.f_bfree" >&5
+echo "configure:6692: checking for statfs.f_bfree" >&5
 if eval "test \"`echo '$''{'wine_cv_statfs_bfree'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6647,7 +6697,7 @@
         wine_cv_statfs_bfree=no
     else
     	cat > conftest.$ac_ext <<EOF
-#line 6651 "configure"
+#line 6701 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -6674,7 +6724,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6678: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_statfs_bfree=yes
 else
@@ -6698,7 +6748,7 @@
 fi
 
 echo $ac_n "checking for statfs.f_bavail""... $ac_c" 1>&6
-echo "configure:6702: checking for statfs.f_bavail" >&5
+echo "configure:6752: checking for statfs.f_bavail" >&5
 if eval "test \"`echo '$''{'wine_cv_statfs_bavail'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6707,7 +6757,7 @@
         wine_cv_statfs_bavail=no
     else
     	cat > conftest.$ac_ext <<EOF
-#line 6711 "configure"
+#line 6761 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -6734,7 +6784,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_statfs_bavail=yes
 else
@@ -6759,12 +6809,12 @@
 
 
 echo $ac_n "checking for msg_accrights in struct msghdr""... $ac_c" 1>&6
-echo "configure:6763: checking for msg_accrights in struct msghdr" >&5
+echo "configure:6813: checking for msg_accrights in struct msghdr" >&5
 if eval "test \"`echo '$''{'ac_cv_c_msg_accrights'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6768 "configure"
+#line 6818 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -6772,7 +6822,7 @@
 struct msghdr hdr; hdr.msg_accrights=0
 ; return 0; }
 EOF
-if { (eval echo configure:6776: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6826: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_msg_accrights="yes"
 else
@@ -6795,12 +6845,12 @@
 
 
 echo $ac_n "checking for sa_len in struct sockaddr""... $ac_c" 1>&6
-echo "configure:6799: checking for sa_len in struct sockaddr" >&5
+echo "configure:6849: checking for sa_len in struct sockaddr" >&5
 if eval "test \"`echo '$''{'ac_cv_c_sockaddr_sa_len'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6804 "configure"
+#line 6854 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -6809,7 +6859,7 @@
 static struct sockaddr addr; addr.sa_len = 1
 ; return 0; }
 EOF
-if { (eval echo configure:6813: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_sockaddr_sa_len="yes"
 else
@@ -6832,12 +6882,12 @@
 
 
 echo $ac_n "checking for sun_len in struct sockaddr_un""... $ac_c" 1>&6
-echo "configure:6836: checking for sun_len in struct sockaddr_un" >&5
+echo "configure:6886: checking for sun_len in struct sockaddr_un" >&5
 if eval "test \"`echo '$''{'ac_cv_c_sockaddr_sun_len'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6841 "configure"
+#line 6891 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -6846,7 +6896,7 @@
 static struct sockaddr_un addr; addr.sun_len = 1
 ; return 0; }
 EOF
-if { (eval echo configure:6850: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6900: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_sockaddr_sun_len="yes"
 else
@@ -6869,12 +6919,12 @@
 
 
 echo $ac_n "checking whether we need to define __i386__""... $ac_c" 1>&6
-echo "configure:6873: checking whether we need to define __i386__" >&5
+echo "configure:6923: checking whether we need to define __i386__" >&5
 if eval "test \"`echo '$''{'ac_cv_cpp_def_i386'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6878 "configure"
+#line 6928 "configure"
 #include "confdefs.h"
 #if (defined(i386) || defined(__i386)) && !defined(__i386__)
 yes
diff --git a/configure.in b/configure.in
index bfce0f6..93fd9cb 100644
--- a/configure.in
+++ b/configure.in
@@ -652,6 +652,34 @@
             [Define if symbols declared in assembly code need an underscore prefix])
 fi
 
+dnl **** Check whether stdcall symbols need to be decorated ****
+
+AC_CACHE_CHECK([whether stdcall symbols need to be decorated],
+               ac_cv_c_stdcall_decoration,
+[saved_libs=$LIBS
+LIBS="conftest_asm.s $LIBS"
+if test "$ac_cv_c_extern_prefix" = "yes"
+then
+cat > conftest_asm.s <<EOF
+	.globl _ac_test@0
+_ac_test@0:
+EOF
+else
+cat > conftest_asm.s <<EOF
+	.globl ac_test@0
+ac_test@0:
+EOF
+fi
+AC_TRY_LINK([extern void __attribute__((__stdcall__)) ac_test(void);],
+            [ac_test(); return 0],
+            ac_cv_c_stdcall_decoration="yes",ac_cv_c_stdcall_decoration="no")
+LIBS=$saved_libs])
+if test "$ac_cv_c_stdcall_decoration" = "yes"
+then
+  AC_DEFINE(NEED_STDCALL_DECORATION, 1,
+            [Define if stdcall symbols need to be decorated])
+fi
+
 dnl **** Check for .string in assembler ****
 
 AC_CACHE_CHECK([whether assembler accepts .string],
diff --git a/include/config.h.in b/include/config.h.in
index b8227ea..7eddb22 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -502,6 +502,9 @@
 /* Define if symbols declared in assembly code need an underscore prefix */
 #undef NEED_UNDERSCORE_PREFIX
 
+/* Define if stdcall symbols need to be decorated */
+#undef NEED_STDCALL_DECORATION
+
 /* Define to use .string instead of .ascii */
 #undef HAVE_ASM_STRING
 
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 9a5e382..8b304c6 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -153,6 +153,7 @@
 extern void BuildRelays32( FILE *outfile );
 extern void BuildSpec16File( FILE *outfile );
 extern void BuildSpec32File( FILE *outfile );
+extern void BuildDef32File( FILE *outfile );
 extern SPEC_TYPE ParseTopLevel( FILE *file );
 
 /* global variables */
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index 6db57a8..37f39bd 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -55,7 +55,15 @@
 static FILE *output_file;
 
 /* execution mode */
-static enum { MODE_NONE, MODE_SPEC, MODE_GLUE, MODE_RELAY16, MODE_RELAY32 } exec_mode = MODE_NONE;
+static enum
+{
+    MODE_NONE,
+    MODE_SPEC,
+    MODE_GLUE,
+    MODE_DEF,
+    MODE_RELAY16,
+    MODE_RELAY32
+} exec_mode = MODE_NONE;
 
 /* open the input file */
 static void open_input( const char *name )
@@ -91,6 +99,7 @@
 static void do_output( const char *arg );
 static void do_usage(void);
 static void do_spec( const char *arg );
+static void do_def( const char *arg );
 static void do_glue( const char *arg );
 static void do_relay16(void);
 static void do_relay32(void);
@@ -105,6 +114,7 @@
     { "-o",       1, do_output,  "-o name          Set the output file name (default: stdout)" },
     { "-sym",     1, do_sym,     "-sym file.o      Read the list of undefined symbols from 'file.o'" },
     { "-spec",    1, do_spec,    "-spec file.spec  Build a .c file from a spec file" },
+    { "-def",     1, do_def,     "-def file.spec   Build a .def file from a spec file" },
     { "-glue",    1, do_glue,    "-glue file.c     Build the 16-bit glue for a .c file" },
     { "-relay16", 0, do_relay16, "-relay16         Build the 16-bit relay assembly routines" },
     { "-relay32", 0, do_relay32, "-relay32         Build the 32-bit relay assembly routines" },
@@ -149,6 +159,13 @@
     open_input( arg );
 }
 
+static void do_def( const char *arg )
+{
+    if (exec_mode != MODE_NONE || !arg[0]) do_usage();
+    exec_mode = MODE_DEF;
+    open_input( arg );
+}
+
 static void do_glue( const char *arg )
 {
     if (exec_mode != MODE_NONE || !arg[0]) do_usage();
@@ -244,6 +261,18 @@
             default: assert(0);
         }
         break;
+    case MODE_DEF:
+        switch (ParseTopLevel( input_file ))
+        {
+            case SPEC_WIN16:
+                fatal_error( "Cannot yet build .def file for 16-bit dlls\n" );
+                break;
+            case SPEC_WIN32:
+                BuildDef32File( output_file );
+                break;
+            default: assert(0);
+        }
+        break;
     case MODE_GLUE:
         BuildGlue( output_file, input_file );
         break;
diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c
index b483e98..d66ec2d 100644
--- a/tools/winebuild/parser.c
+++ b/tools/winebuild/parser.c
@@ -510,7 +510,6 @@
 	else if (strcmp(token, "file") == 0)
 	{
 	    strcpy(DLLFileName, GetToken(0));
-	    strupper(DLLFileName);
 	}
         else if (strcmp(token, "type") == 0)
         {
@@ -612,7 +611,12 @@
     if (!DLLFileName[0])
     {
         if (SpecMode == SPEC_MODE_DLL)
-            sprintf( DLLFileName, "%s.dll", DLLName );
+	{
+	    strcpy( DLLFileName, DLLName );
+	    /* Append .dll to name if no extension present */
+	    if (!strrchr( DLLFileName, '.'))
+		strcat( DLLFileName, ".dll" );
+	}
         else
             sprintf( DLLFileName, "%s.exe", DLLName );
     }
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 3c60078..95444e3 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -759,3 +759,70 @@
                  "}\n", DLLName );
     }
 }
+
+
+/*******************************************************************
+ *         BuildDef32File
+ *
+ * Build a Win32 def file from a spec file.
+ */
+void BuildDef32File(FILE *outfile)
+{
+    int i;
+
+    AssignOrdinals();
+
+    fprintf(outfile, "; File generated automatically from %s; do not edit!\n\n",
+            input_file_name );
+
+    fprintf(outfile, "LIBRARY lib%s\n\n", DLLFileName);
+
+    fprintf(outfile, "EXPORTS\n");
+
+    /* Output the exports and relay entry points */
+
+    for(i = 0; i < nb_entry_points; i++)
+    {
+        ORDDEF *odp = EntryPoints[i];
+        if(!odp || !*odp->name || (odp->flags & FLAG_NOIMPORT)) continue;
+
+        fprintf(outfile, "  %s", odp->name);
+
+        switch(odp->type)
+        {
+        case TYPE_EXTERN:
+        case TYPE_VARARGS:
+        case TYPE_CDECL:
+        case TYPE_VARIABLE:
+            /* try to reduce output */
+            if(strcmp(odp->name, odp->link_name))
+                fprintf(outfile, "=%s", odp->link_name);
+            break;
+        case TYPE_STDCALL:
+        {
+#ifdef NEED_STDCALL_DECORATION
+            int at_param = strlen(odp->u.func.arg_types) * sizeof(int);
+            fprintf(outfile, "@%d", at_param);
+#endif /* NEED_STDCALL_DECORATION */
+            /* try to reduce output */
+            if(strcmp(odp->name, odp->link_name))
+            {
+                fprintf(outfile, "=%s", odp->link_name);
+#ifdef NEED_STDCALL_DECORATION
+                fprintf(outfile, "@%d", at_param);
+#endif /* NEED_STDCALL_DECORATION */
+            }
+            break;
+        }
+        case TYPE_STUB:
+            fprintf(outfile, "=%s", make_internal_name( odp, "stub" ));
+            break;
+        case TYPE_FORWARD:
+            fprintf(outfile, "=lib%s", odp->link_name);
+            break;
+        default:
+            assert(0);
+        }
+        fprintf(outfile, " @%d\n", odp->ordinal);
+    }
+}