# make exports file
my $command = "echo EXPORTS > perl.def";
print "$command\n";
-system($command);
+system($command) == 0 or die "system() failed.\n";
$command ="nm $libstring | grep '^........ [TCD] _'| grep -v _impure_ptr | sed 's/[^_]*_//' >> perl.def";
print "$command\n";
-system($command);
+system($command) == 0 or die "system() failed.\n";
# Build the perl.a lib to link to:
$command ="dlltool --as=as --dllname perl.exe --def perl.def --output-lib perl.a";
print "$command\n";
-system($command);
+system($command) == 0 or die "system() failed.\n";
# change name of export lib to libperlexp so that is can be understood by ld2/perlld
$command ="mv perl.a libperlexp.a";
print "$command\n";
-system($command);
+system($command) == 0 or die "system() failed.\n";
# get the full path name of a few libs:
my $crt0 = `gcc -print-file-name=crt0.o`;
chomp $libdir;
$libdir =~ s/libcygwin\.a//g;
+# when $crt0 and $libdir get used in the system calls below, the \'s
+# from the gcc -print-file-name get used to create special characters,
+# such as \n, \t. Replace the \'s with /'s so that this does not
+# happen:
+$crt0 =~ s:\\:/:g;
+$libdir =~ s:\\:/:g;
+
+# when $crt0 and $libdir get used in the system calls below, the \'s
+# from the gcc -print-file-name get used to create special characters,
+# such as \n, \t. Replace the \'s with /'s so that this does not
+# happen:
+$crt0 =~ s:\\:/:g;
+$libdir =~ s:\\:/:g;
+
# Link exe:
$command = "ld --base-file perl.base -o perl.exe $crt0 $obsString $libstring -L$libdir $libflagString";
print "$command\n";
-system($command);
+system($command) == 0 or die "system() failed.\n";
$command = "dlltool --as=as --dllname perl.exe --def perl.def --base-file perl.base --output-exp perl.exp";
print "$command\n";
-system($command);
+system($command) == 0 or die "system() failed.\n";
$command = "ld --base-file perl.base perl.exp -o perl.exe $crt0 $obsString $libstring -L$libdir $libflagString";
print "$command\n";
-system($command);
+system($command) == 0 or die "system() failed.\n";
$command = "dlltool --as=as --dllname perl.exe --def perl.def --base-file perl.base --output-exp perl.exp";
print "$command\n";
-system($command);
+system($command) == 0 or die "system() failed.\n";
$command = "ld perl.exp -o perl.exe $crt0 $obsString $libstring -L$libdir $libflagString";
print "$command\n";
-system($command);
+system($command) == 0 or die "system() failed.\n";
print "perlgcc: Completed\n";
writeInit();
$command = "gcc -c $fixup.c\n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
$command = "gcc -c $init.cc\n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
$command = "echo EXPORTS > $libname.def\n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
$command = "nm ".join(" ",@objs)." $init.o $fixup.o | grep '^........ [TCD] _' | sed 's/[^_]*_//' >> $libname.def\n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
$command = "ld --base-file $libname.base --dll -o $libname.dll ".join(" ",@objs)." $init.o $fixup.o ";
$command .= join(" ",@flags)." -e _dll_entry\@12 \n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
$command = "dlltool --as=as --dllname $libname.dll --def $libname.def --base-file $libname.base --output-exp $libname.exp\n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
$command = "ld --base-file $libname.base $libname.exp --dll -o $libname.dll ".join(" ",@objs)." $init.o $fixup.o ";
$command .= join(" ",@flags)." -e _dll_entry\@12 \n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
$command = "dlltool --as=as --dllname $libname.dll --def $libname.def --base-file $libname.base --output-exp $libname.exp\n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
$command = "ld $libname.exp --dll -o $libname.dll ".join(" ",@objs)." $init.o $fixup.o ";
$command .= join(" ",@flags)." -e _dll_entry\@12 \n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
print "Build the import lib\n";
$command = "dlltool --as=as --dllname $libname.dll --def $libname.def --output-lib $libname.a\n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
# if there was originally a path, copy the dll and a to that location:
if($path && $path ne "./" && $path."\n" ne "`pwd`"){
$command = "mv $libname.dll $path".$libname.".dll\n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
$command = "mv $libname.a $path".$libname.".a\n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
}
else{ # no special processing, just call ld
$command = "ld $args\n";
print $command;
- system($command);
+ system($command) == 0 or die "system() failed.\n";
}
#---------------------------------------------------------------------------
Malloc_t
-safemalloc(size_t size)
+safemalloc(MEM_SIZE size)
{
Malloc_t ptr;
/* paranoid version of realloc */
Malloc_t
-saferealloc(void *where, size_t size)
+saferealloc(Malloc_t where, MEM_SIZE size)
{
Malloc_t ptr;
/* safe version of free */
Free_t
-safefree(void *where)
+safefree(Malloc_t where)
{
#ifdef DEBUGGING
if (debug & 128)