From: Gurusamy Sarathy Date: Sun, 14 Jun 1998 18:51:53 +0000 (+0000) Subject: various win32 fixes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=852c2e52c116ddde31d81b646561262ed796257a;p=p5sagit%2Fp5-mst-13.2.git various win32 fixes - fixes that silence VC noises about dup exports, non-default libs, and unsupported *.def file directives - s/inplace/inplace_label/ malloc.c - update Config{usemymalloc} based on d_mymalloc - export Perl_*Vars - fix makefiles to not build miniperl.exe twice, and to make it properly when defaults are changed p4raw-id: //depot/perl@1129 --- diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 5b0184c..299855b 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -164,8 +164,8 @@ sub init_others $self->{'LDLOADLIBS'} ||= ( $BORLAND ? 'import32.lib cw32mti.lib ' - : ( $OBJ ? '' : 'msvcrt.lib ' ) - .'oldnames.lib kernel32.lib comdlg32.lib winspool.lib gdi32.lib ' + : # compiler adds msvcrtd?.lib according to debug switches + 'oldnames.lib kernel32.lib comdlg32.lib winspool.lib gdi32.lib ' .'advapi32.lib user32.lib shell32.lib netapi32.lib ole32.lib ' .'oleaut32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib ' ) . ' odbc32.lib odbccp32.lib'; diff --git a/lib/ExtUtils/Mksymlists.pm b/lib/ExtUtils/Mksymlists.pm index efee155..0b92ca0 100644 --- a/lib/ExtUtils/Mksymlists.pm +++ b/lib/ExtUtils/Mksymlists.pm @@ -112,10 +112,6 @@ sub _write_win32 { # put library name in quotes (it could be a keyword, like 'Alias') if ($Config::Config{'cc'} !~ /^gcc/i) { print DEF "LIBRARY \"$data->{DLBASE}\"\n"; - if ($Config{'ccflags'} !~ /PERL_OBJECT/i) { - print DEF "CODE LOADONCALL\n"; - print DEF "DATA LOADONCALL NONSHARED MULTIPLE\n"; - } } print DEF "EXPORTS\n "; my @syms; diff --git a/malloc.c b/malloc.c index 805cc4e..c87f3cd 100644 --- a/malloc.c +++ b/malloc.c @@ -1116,7 +1116,7 @@ realloc(void *mp, size_t nbytes) #endif ) goto hard_way; else if (incr == 0) { - inplace: + inplace_label: #ifdef RCHECK /* * Record new allocated size of block and @@ -1203,7 +1203,7 @@ realloc(void *mp, size_t nbytes) nmalloc[pow * BUCKETS_PER_POW2]++; #endif *(cp - M_OVERHEAD) = pow * BUCKETS_PER_POW2; /* Fill index. */ - goto inplace; + goto inplace_label; } else { hard_way: MUTEX_UNLOCK(&malloc_mutex); diff --git a/win32/Makefile b/win32/Makefile index 7ea64cb..483f177 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -242,7 +242,7 @@ NULL = XSUBPP = ..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp \ -C++ -prototypes -CORE_SRC = \ +MICROCORE_SRC = \ ..\av.c \ ..\byterun.c \ ..\deb.c \ @@ -271,15 +271,15 @@ CORE_SRC = \ ..\util.c !IF "$(CRYPT_SRC)" != "" -CORE_SRC = $(CORE_SRC) ..\$(CRYPT_SRC) +MICROCORE_SRC = $(MICROCORE_SRC) ..\$(CRYPT_SRC) !ENDIF !IF "$(PERL_MALLOC)" == "define" -CORE_SRC = $(CORE_SRC) ..\malloc.c +EXTRACORE_SRC = $(EXTRACORE_SRC) ..\malloc.c !ENDIF !IF "$(OBJECT)" == "" -CORE_SRC = $(CORE_SRC) ..\perlio.c +EXTRACORE_SRC = $(EXTRACORE_SRC) ..\perlio.c !ENDIF WIN32_SRC = \ @@ -313,7 +313,7 @@ X2P_SRC = \ ..\x2p\util.c \ ..\x2p\walk.c -CORE_H = \ +CORE_NOCFG_H = \ ..\av.h \ ..\byterun.h \ ..\bytecode.h \ @@ -343,7 +343,6 @@ CORE_H = \ ..\unixish.h \ ..\util.h \ ..\XSUB.h \ - .\config.h \ ..\EXTERN.h \ ..\perlvars.h \ ..\intrpvar.h \ @@ -353,19 +352,20 @@ CORE_H = \ .\include\sys\socket.h \ .\win32.h -CORE_OBJ = $(CORE_SRC:.c=.obj) +CORE_H = $(CORE_NOCFG_H) .\config.h + +MICROCORE_OBJ = $(MICROCORE_SRC:.c=.obj) +CORE_OBJ = $(MICROCORE_OBJ) $(EXTRACORE_SRC:.c=.obj) WIN32_OBJ = $(WIN32_SRC:.c=.obj) -MINICORE_OBJ = $(CORE_OBJ:..\=.\mini\) $(MINIDIR)\miniperlmain$(o) +MINICORE_OBJ = $(MICROCORE_OBJ:..\=.\mini\) \ + $(MINIDIR)\miniperlmain$(o) \ + $(MINIDIR)\perlio$(o) MINIWIN32_OBJ = $(WIN32_OBJ:.\=.\mini\) MINI_OBJ = $(MINICORE_OBJ) $(MINIWIN32_OBJ) PERL95_OBJ = $(PERL95_SRC:.c=.obj) DLL_OBJ = $(DLL_SRC:.c=.obj) X2P_OBJ = $(X2P_SRC:.c=.obj) -!IF "$(OBJECT)" != "" -MINICORE_OBJ = $(MINICORE_OBJ) $(MINIDIR)\perlio$(o) -!ENDIF - PERLDLL_OBJ = $(CORE_OBJ) PERLEXE_OBJ = perlmain$(o) @@ -458,8 +458,8 @@ CFG_VARS = \ # Top targets # -all : $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) $(CAPILIB) $(X2P) \ - $(EXTENSION_DLL) +all : .\config.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) \ + $(CAPILIB) $(X2P) $(EXTENSION_DLL) $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c @@ -512,15 +512,18 @@ $(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(MINIDIR) : if not exist "$(MINIDIR)" mkdir "$(MINIDIR)" -$(MINICORE_OBJ) : $(CORE_H) +$(MINICORE_OBJ) : $(CORE_NOCFG_H) $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ ..\$(*F).c -$(MINIWIN32_OBJ) : $(CORE_H) +$(MINIWIN32_OBJ) : $(CORE_NOCFG_H) $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ $(*F).c +# 1. we don't want to rebuild miniperl.exe when config.h changes +# 2. we don't want to rebuild miniperl.exe with non-default config.h +$(MINI_OBJ) : $(CORE_NOCFG_H) + $(WIN32_OBJ) : $(CORE_H) $(CORE_OBJ) : $(CORE_H) -$(MINI_OBJ) : $(CORE_H) $(DLL_OBJ) : $(CORE_H) $(PERL95_OBJ) : $(CORE_H) $(X2P_OBJ) : $(CORE_H) diff --git a/win32/config_sh.PL b/win32/config_sh.PL index 0c3713c..45c1ba4 100644 --- a/win32/config_sh.PL +++ b/win32/config_sh.PL @@ -13,6 +13,7 @@ if ($] =~ /\.(\d\d\d)?(\d\d)?$/) { # should always be true $opt{'cf_by'} = $ENV{USERNAME} unless $opt{'cf_by'}; $opt{'cf_email'} = $opt{'cf_by'} . '@' . (gethostbyname('localhost'))[0] unless $opt{'cf_email'}; +$opt{'usemymalloc'} = 'y' if $opt{'d_mymalloc'} eq 'define'; while (<>) { diff --git a/win32/makedef.pl b/win32/makedef.pl index 4e317b5..65e8023 100644 --- a/win32/makedef.pl +++ b/win32/makedef.pl @@ -45,8 +45,6 @@ if ($CCTYPE ne 'GCC') { print "LIBRARY Perl\n"; print "DESCRIPTION 'Perl interpreter, export autogenerated'\n"; - print "CODE LOADONCALL\n"; - print "DATA LOADONCALL NONSHARED MULTIPLE\n"; } else { @@ -320,6 +318,8 @@ if ($define{'PERL_GLOBAL_STRUCT'}) { my $global = readvar("../perlvars.h"); skip_symbols $global; + emit_symbols [qw(Perl_GetVars)]; + emit_symbols [qw(Perl_Vars Perl_VarsPtr)] unless $CCTYPE eq 'GCC'; } unless ($define{'DEBUGGING'}) @@ -360,11 +360,7 @@ close(GLOBAL); # doesn't hurt to include them anyway. # these don't have Perl prefix -if ($define{'PERL_GLOBAL_STRUCT'}) - { - emit_symbol( ($CCTYPE eq 'GCC') ? 'Perl_GetVars' : 'Perl_VarsPtr') - } -else +unless ($define{'PERL_GLOBAL_STRUCT'}) { my $glob = readvar("../perlvars.h"); emit_symbols $glob; diff --git a/win32/makefile.mk b/win32/makefile.mk index 39b0b10..6b544c5 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -352,7 +352,7 @@ NOOP = @echo XSUBPP = ..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp \ -C++ -prototypes -CORE_SRC = \ +MICROCORE_SRC = \ ..\av.c \ ..\byterun.c \ ..\deb.c \ @@ -381,15 +381,15 @@ CORE_SRC = \ ..\util.c .IF "$(CRYPT_SRC)" != "" -CORE_SRC += ..\$(CRYPT_SRC) +MICROCORE_SRC += ..\$(CRYPT_SRC) .ENDIF .IF "$(PERL_MALLOC)" == "define" -CORE_SRC += ..\malloc.c +EXTRACORE_SRC += ..\malloc.c .ENDIF .IF "$(OBJECT)" == "" -CORE_SRC += ..\perlio.c +EXTRACORE_SRC += ..\perlio.c .ENDIF WIN32_SRC = \ @@ -423,7 +423,7 @@ X2P_SRC = \ ..\x2p\util.c \ ..\x2p\walk.c -CORE_H = \ +CORE_NOCFG_H = \ ..\av.h \ ..\byterun.h \ ..\bytecode.h \ @@ -453,7 +453,6 @@ CORE_H = \ ..\unixish.h \ ..\util.h \ ..\XSUB.h \ - .\config.h \ ..\EXTERN.h \ ..\perlvars.h \ ..\intrpvar.h \ @@ -463,19 +462,18 @@ CORE_H = \ .\include\sys\socket.h \ .\win32.h -CORE_OBJ = $(CORE_SRC:db:+$(o)) +CORE_H = $(CORE_NOCFG_H) .\config.h + +MICROCORE_OBJ = $(MICROCORE_SRC:db:+$(o)) +CORE_OBJ = $(MICROCORE_OBJ) $(EXTRACORE_SRC:db:+$(o)) WIN32_OBJ = $(WIN32_SRC:db:+$(o)) -MINICORE_OBJ = $(MINIDIR)\{$(CORE_OBJ:f) miniperlmain$(o)} +MINICORE_OBJ = $(MINIDIR)\{$(MICROCORE_OBJ:f) miniperlmain$(o) perlio$(o)} MINIWIN32_OBJ = $(MINIDIR)\{$(WIN32_OBJ:f)} MINI_OBJ = $(MINICORE_OBJ) $(MINIWIN32_OBJ) PERL95_OBJ = $(PERL95_SRC:db:+$(o)) DLL_OBJ = $(DLL_SRC:db:+$(o)) X2P_OBJ = $(X2P_SRC:db:+$(o)) -.IF "$(OBJECT)" != "" -MINICORE_OBJ += $(MINIDIR)\perlio$(o) -.ENDIF - PERLDLL_OBJ = $(CORE_OBJ) PERLEXE_OBJ = perlmain$(o) @@ -567,8 +565,8 @@ CFG_VARS = \ # Top targets # -all : $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) $(CAPILIB) $(X2P) \ - $(EXTENSION_DLL) +all : .\config.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) \ + $(CAPILIB) $(X2P) $(EXTENSION_DLL) $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c @@ -591,7 +589,7 @@ perlglob$(o) : perlglob.c config.w32 : $(CFGSH_TMPL) copy $(CFGSH_TMPL) config.w32 -.\config.h : $(CFGH_TMPL) +.\config.h : $(CFGH_TMPL) $(CORE_NOCFG_H) -del /f config.h copy $(CFGH_TMPL) config.h @@ -634,15 +632,18 @@ $(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(MINIDIR) : if not exist "$(MINIDIR)" mkdir "$(MINIDIR)" -$(MINICORE_OBJ) : $(CORE_H) +$(MINICORE_OBJ) : $(CORE_NOCFG_H) $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ ..\$(*B).c -$(MINIWIN32_OBJ) : $(CORE_H) +$(MINIWIN32_OBJ) : $(CORE_NOCFG_H) $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ $(*B).c +# 1. we don't want to rebuild miniperl.exe when config.h changes +# 2. we don't want to rebuild miniperl.exe with non-default config.h +$(MINI_OBJ) : $(CORE_NOCFG_H) + $(WIN32_OBJ) : $(CORE_H) $(CORE_OBJ) : $(CORE_H) -$(MINI_OBJ) : $(CORE_H) $(DLL_OBJ) : $(CORE_H) $(PERL95_OBJ) : $(CORE_H) $(X2P_OBJ) : $(CORE_H) diff --git a/win32/perllib.c b/win32/perllib.c index 4b57963..3bec9c0 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -9,7 +9,7 @@ static void xs_init _((void)); -__declspec(dllexport) int +DllExport int RunPerl(int argc, char **argv, char **env, void *iosubsystem) { int exitstatus; diff --git a/win32/win32.h b/win32/win32.h index 5242018..a6a2f9d 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -46,7 +46,8 @@ typedef long long __int64; #define DllExport #else #if defined(PERLDLL) || defined(WIN95FIX) -#define DllExport __declspec(dllexport) +#define DllExport +/*#define DllExport __declspec(dllexport)*/ /* noises with VC5+sp3 */ #else #define DllExport __declspec(dllimport) #endif