#include "EXTERN.h"
#include "perl.h"
+#include "win32.h"
#ifdef PERL_OBJECT
#define NO_XSLOCKS
#include "XSUB.h"
+static SV *error_sv;
+
+static char *
+OS_Error_String(void)
+{
+ DWORD err = GetLastError();
+ STRLEN len;
+ if (!error_sv)
+ error_sv = newSVpv("",0);
+ win32_str_os_error(error_sv,err);
+ return SvPV(error_sv,len);
+}
+
#include "dlutils.c" /* SaveError() etc */
static void
DLDEBUG(2,PerlIO_printf(PerlIO_stderr()," libref=%x\n", RETVAL));
ST(0) = sv_newmortal() ;
if (RETVAL == NULL)
- SaveError(PERL_OBJECT_THIS_ "%d",GetLastError()) ;
+ SaveError(PERL_OBJECT_THIS_ "load_file:%s",OS_Error_String()) ;
else
sv_setiv( ST(0), (IV)RETVAL);
DLDEBUG(2,PerlIO_printf(PerlIO_stderr()," symbolref = %x\n", RETVAL));
ST(0) = sv_newmortal() ;
if (RETVAL == NULL)
- SaveError(PERL_OBJECT_THIS_ "%d",GetLastError()) ;
+ SaveError(PERL_OBJECT_THIS_ "find_symbol:%s",OS_Error_String()) ;
else
sv_setiv( ST(0), (IV)RETVAL);
.ELIF "$(CCTYPE)" == "GCC"
-CC = gcc -pipe
-LINK32 = gcc -pipe
+CC = gcc
+LINK32 = gcc
LIB32 = ar rc
IMPLIB = dlltool
o = .o
+a = .a
#
# Options
############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ##############
o *= .obj
+a *= .lib
LKPRE = INPUT (
LKPOST = )
# Rules
#
-.SUFFIXES : .c $(o) .dll .lib .exe .a
+.SUFFIXES : .c $(o) .dll $(a) .exe
.c$(o):
$(CC) -c $(null,$(<:d) $(NULL) -I$(<:d)) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $<
$(IMPLIB) $(*B).lib $@
.ELIF "$(CCTYPE)" == "GCC"
$(LINK32) -o $@ $(LINK_FLAGS) $< $(LIBFILES)
- $(IMPLIB) -def $(*B).def $(*B).lib $@
+ $(IMPLIB) -def $(*B).def $(*B).a $@
.ELSE
$(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \
-out:$@ $(LINK_FLAGS) $(LIBFILES) $< $(LIBPERL)
#
# various targets
-.IF "$(OBJECT)" == "-DPERL_OBJECT"
-PERLIMPLIB = ..\perlcore.lib
-PERLDLL = ..\perlcore.dll
-CAPILIB = $(COREDIR)\PerlCAPI.lib
-.ELSE
-PERLIMPLIB = ..\perl.lib
-PERLDLL = ..\perl.dll
-CAPILIB =
-.ENDIF
-
MINIPERL = ..\miniperl.exe
MINIDIR = .\mini
PERLEXE = ..\perl.exe
CFGSH_TMPL = config.gc
CFGH_TMPL = config_H.gc
+PERLIMPLIB *= ..\libperl$(a)
.ELSE
.ENDIF
+.IF "$(OBJECT)" == "-DPERL_OBJECT"
+PERLIMPLIB *= ..\perlcore$(a)
+PERLDLL = ..\perlcore.dll
+CAPILIB = $(COREDIR)\PerlCAPI$(a)
+.ELSE
+PERLIMPLIB *= ..\perl$(a)
+PERLDLL = ..\perl.dll
+CAPILIB =
+.ENDIF
+
XCOPY = xcopy /f /r /i /d
RCOPY = xcopy /f /r /i /e /d
NOOP = @echo
MICROCORE_OBJ = $(MICROCORE_SRC:db:+$(o))
CORE_OBJ = $(MICROCORE_OBJ) $(EXTRACORE_SRC:db:+$(o))
WIN32_OBJ = $(WIN32_SRC:db:+$(o))
-MINICORE_OBJ = $(MINIDIR)\{$(MICROCORE_OBJ:f) miniperlmain$(o) perlio$(o)}
+MINICORE_OBJ = $(MINIDIR)\{$(MICROCORE_OBJ:f) miniperlmain$(o) $(EXTRACORE_SRC:db:+$(o))}
MINIWIN32_OBJ = $(MINIDIR)\{$(WIN32_OBJ:f)}
MINI_OBJ = $(MINICORE_OBJ) $(MINIWIN32_OBJ)
PERL95_OBJ = $(PERL95_SRC:db:+$(o))
"d_mymalloc=$(PERL_MALLOC)" \
"libs=$(LIBFILES:f)" \
"incpath=$(CCINCDIR)" \
- "libperl=$(PERLIMPLIB)" \
+ "libperl=$(PERLIMPLIB:f)" \
"libpth=$(strip $(CCLIBDIR) $(LIBFILES:d))" \
"libc=$(LIBC)" \
"make=dmake" \
+ "_o=$(o)" "obj_ext=$(o)" \
+ "_a=$(a)" "lib_ext=$(a)" \
"static_ext=$(STATIC_EXT)" \
"dynamic_ext=$(DYNAMIC_EXT)" \
"usethreads=$(USE_THREADS)" \
distclean: clean
-del /f $(MINIPERL) $(PERLEXE) $(PERL95EXE) $(PERLDLL) $(GLOBEXE) \
- $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
+ $(PERLIMPLIB) ..\miniperl$(a) $(MINIMOD)
-del /f *.def *.map
-del /f $(EXTENSION_DLL)
-del /f $(EXTENSION_C) $(DYNALOADER).c
-del /f perl95.c
.ENDIF
-del /f bin\*.bat
- -cd $(EXTDIR) && del /s *.lib *.def *.map *.bs Makefile *$(o) pm_to_blib
+ -cd $(EXTDIR) && del /s *$(a) *.def *.map *.bs Makefile *$(o) pm_to_blib
-rmdir /s /q $(AUTODIR) || rmdir /s $(AUTODIR)
-rmdir /s /q $(COREDIR) || rmdir /s $(COREDIR)
-@erase $(WIN32_OBJ)
-@erase $(DLL_OBJ)
-@erase $(X2P_OBJ)
- -@erase ..\*$(o) ..\*.lib ..\*.exp *$(o) *.lib *.exp
+ -@erase ..\*$(o) ..\*$(a) ..\*.exp *$(o) *$(a) *.exp
-@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
-@erase ..\x2p\*.exe ..\x2p\*.bat
-@erase *.ilk