Type "dmake" (or "nmake" if you are using that make).
This should build everything. Specifically, it will create perl.exe,
-perl.dll (or perlcore.dll), and perlglob.exe at the perl toplevel, and
+perl.dll (or perl56.dll), and perlglob.exe at the perl toplevel, and
various other extension dll's under the lib\auto directory. If the build
fails for any reason, make sure you have done the previous steps correctly.
void*
CPerlObj::operator new(size_t nSize, IPerlMem *pvtbl)
{
- if(pvtbl != NULL)
+ if(pvtbl)
return pvtbl->pMalloc(pvtbl, nSize);
return NULL;
}
void
+CPerlObj::operator delete(void *pPerl, IPerlMem *pvtbl)
+{
+ if(pvtbl)
+ pvtbl->pFree(pvtbl, pPerl);
+}
+
+void
CPerlObj::Init(void)
{
}
};
} else {
$perldll = 'perl.' . $dlext;
- $perldll = 'perlcore.' . $dlext if $Config{'ccflags'} =~ /PERL_OBJECT/i;
+ $perldll = 'perl56.' . $dlext if $Config{'ccflags'} =~ /PERL_OBJECT/i;
}
-f $perldll || die "No perl DLL built\n";
struct IPerlEnv;
typedef char* (*LPEnvGetenv)(struct IPerlEnv*, const char*);
typedef int (*LPEnvPutenv)(struct IPerlEnv*, const char*);
-typedef char * (*LPEnvGetenv_len)(struct IPerlEnv*,
+typedef char* (*LPEnvGetenv_len)(struct IPerlEnv*,
const char *varname, unsigned long *len);
typedef int (*LPEnvUname)(struct IPerlEnv*, struct utsname *name);
typedef void (*LPEnvClearenv)(struct IPerlEnv*);
-typedef unsigned long (*LPEnvOsID)(struct IPerlEnv*);
+typedef void* (*LPEnvGetChildenv)(struct IPerlEnv*);
+typedef void (*LPEnvFreeChildenv)(struct IPerlEnv*, void* env);
+typedef char* (*LPEnvGetChilddir)(struct IPerlEnv*);
+typedef void (*LPEnvFreeChilddir)(struct IPerlEnv*, char* dir);
#ifdef HAS_ENVGETENV
-typedef char * (*LPENVGetenv)(struct IPerlEnv*, const char *varname);
-typedef char * (*LPENVGetenv_len)(struct IPerlEnv*,
+typedef char* (*LPENVGetenv)(struct IPerlEnv*, const char *varname);
+typedef char* (*LPENVGetenv_len)(struct IPerlEnv*,
const char *varname, unsigned long *len);
#endif
#ifdef WIN32
+typedef unsigned long (*LPEnvOsID)(struct IPerlEnv*);
typedef char* (*LPEnvLibPath)(struct IPerlEnv*, char*);
typedef char* (*LPEnvSiteLibPath)(struct IPerlEnv*, char*);
#endif
LPEnvGetenv_len pGetenv_len;
LPEnvUname pEnvUname;
LPEnvClearenv pClearenv;
+ LPEnvGetChildenv pGetChildenv;
+ LPEnvFreeChildenv pFreeChildenv;
+ LPEnvGetChilddir pGetChilddir;
+ LPEnvFreeChilddir pFreeChilddir;
#ifdef HAS_ENVGETENV
LPENVGetenv pENVGetenv;
LPENVGetenv_len pENVGetenv_len;
(*PL_Env->pGetenv)(PL_Env,(str))
#define PerlEnv_getenv_len(str,l) \
(*PL_Env->pGetenv_len)(PL_Env,(str), (l))
-#define PerlEnv_Clear() \
- (*PL_Env->pClearenv)(PL_Env)
-#define PerlEnv_Clear() \
+#define PerlEnv_clearenv() \
(*PL_Env->pClearenv)(PL_Env)
+#define PerlEnv_get_childenv() \
+ (*PL_Env->pGetChildenv)(PL_Env)
+#define PerlEnv_free_childenv(e) \
+ (*PL_Env->pFreeChildenv)(PL_Env, (e))
+#define PerlEnv_get_childdir() \
+ (*PL_Env->pGetChilddir)(PL_Env)
+#define PerlEnv_free_childdir(d) \
+ (*PL_Env->pFreeChilddir)(PL_Env, (d))
#ifdef HAS_ENVGETENV
# define PerlEnv_ENVgetenv(str) \
(*PL_Env->pENVGetenv)(PL_Env,(str))
#define PerlEnv_putenv(str) putenv((str))
#define PerlEnv_getenv(str) getenv((str))
#define PerlEnv_getenv_len(str,l) getenv_len((str), (l))
+#define PerlEnv_clear() clearenv()
+#define PerlEnv_get_childenv() get_childenv()
+#define PerlEnv_free_childenv(e) free_childenv((e))
+#define PerlEnv_get_childdir() get_childdir()
+#define PerlEnv_free_childdir(d) free_childdir((d))
#ifdef HAS_ENVGETENV
# define PerlEnv_ENVgetenv(str) ENVgetenv((str))
# define PerlEnv_ENVgetenv_len(str,l) ENVgetenv_len((str), (l))
if ($PLATFORM eq 'win32') {
warn join(' ',keys %define)."\n";
if ($define{PERL_OBJECT}) {
- print "LIBRARY PerlCore\n";
+ print "LIBRARY Perl56\n";
print "DESCRIPTION 'Perl interpreter'\n";
print "EXPORTS\n";
# output_symbol("perl_alloc");
CPerlObj(IPerlMem*, IPerlEnv*, IPerlStdIO*, IPerlLIO*, IPerlDir*, IPerlSock*, IPerlProc*);
void Init(void);
void* operator new(size_t nSize, IPerlMem *pvtbl);
+ static void operator delete(void* pPerl, IPerlMem *pvtbl);
#endif /* PERL_OBJECT */
#ifdef PERL_GLOBAL_STRUCT
#
# various targets
!IF "$(USE_OBJECT)" == "define"
-PERLIMPLIB = ..\perlcore.lib
-PERLDLL = ..\perlcore.dll
+PERLIMPLIB = ..\perl56.lib
+PERLDLL = ..\perl56.dll
!ELSE
PERLIMPLIB = ..\perl.lib
PERLDLL = ..\perl.dll
.ENDIF
.IF "$(USE_OBJECT)" == "define"
-PERLIMPLIB *= ..\perlcore$(a)
-PERLDLL = ..\perlcore.dll
+PERLIMPLIB *= ..\perl56$(a)
+PERLDLL = ..\perl56.dll
.ELSE
PERLIMPLIB *= ..\perl$(a)
PERLDLL = ..\perl.dll
return win32_uname(name);
}
+void
+PerlEnvClearenv(struct IPerlEnv*)
+{
+ dTHXo;
+ char *envv = GetEnvironmentStrings();
+ char *cur = envv;
+ STRLEN len;
+ while (*cur) {
+ char *end = strchr(cur,'=');
+ if (end && end != cur) {
+ *end = '\0';
+ my_setenv(cur,Nullch);
+ *end = '=';
+ cur = end + strlen(end+1)+2;
+ }
+ else if ((len = strlen(cur)))
+ cur += len+1;
+ }
+ FreeEnvironmentStrings(envv);
+}
+
+void*
+PerlEnvGetChildEnv(struct IPerlEnv*)
+{
+ return NULL;
+}
+
+void
+PerlEnvFreeChildEnv(struct IPerlEnv*, void* env)
+{
+}
+
+char*
+PerlEnvGetChildDir(struct IPerlEnv*)
+{
+ return NULL;
+}
+
+void
+PerlEnvFreeChildDir(struct IPerlEnv*, char* dir)
+{
+}
+
unsigned long
PerlEnvOsId(struct IPerlEnv*)
{
PerlEnvPutenv,
PerlEnvGetenv_len,
PerlEnvUname,
- NULL,
+ PerlEnvClearenv,
+ PerlEnvGetChildEnv,
+ PerlEnvFreeChildEnv,
+ PerlEnvGetChildDir,
+ PerlEnvFreeChildDir,
PerlEnvOsId,
PerlEnvLibPath,
PerlEnvSiteLibPath,
void
PerlStdIOInitOSExtras(struct IPerlStdIO*)
{
+ dTHXo;
+ xs_init(pPerl);
Perl_init_os_extras();
}
CPerlObj* pPerl = (CPerlObj*)sv_interp;
try
{
- retVal = pPerl->perl_parse(xs_init, argc, argv, env);
+ retVal = pPerl->perl_parse(xsinit, argc, argv, env);
}
/*
catch(int x)
#undef PL_perl_destruct_level
#define PL_perl_destruct_level int dummy
-#undef w32_perldll_handle
-#define w32_perldll_handle g_w32_perldll_handle
-HANDLE g_w32_perldll_handle;
-#else
-extern HANDLE w32_perldll_handle;
#endif /* PERL_OBJECT */
+extern HANDLE w32_perldll_handle;
static DWORD g_TlsAllocIndex;
EXTERN_C DllExport bool
perl_construct( my_perl );
PL_perl_destruct_level = 0;
+#ifdef PERL_OBJECT
+ /* PERL_OBJECT build sets Dynaloader in PerlStdIOInitOSExtras */
+ exitstatus = perl_parse(my_perl, NULL, argc, argv, env);
+#else
exitstatus = perl_parse(my_perl, xs_init, argc, argv, env);
+#endif
if (!exitstatus) {
exitstatus = perl_run( my_perl );
}
#endif
g_TlsAllocIndex = TlsAlloc();
DisableThreadLibraryCalls(hModule);
-#ifndef PERL_OBJECT
w32_perldll_handle = hModule;
-#endif
break;
/* The DLL is detaching from a process due to
return Nullch;
}
+/* The following are just place holders.
+ * Some hosts may provide and environment that the OS is
+ * not tracking, therefore, these host must provide that
+ * environment and the current directory to CreateProcess
+ */
+
+void*
+get_childenv(void)
+{
+ return NULL;
+}
+
+void
+free_childenv(void*)
+{
+}
+
+char*
+get_childdir(void)
+{
+ return NULL;
+}
+
+void
+free_childdir(char*)
+{
+}
+
+
/* XXX this needs to be made more compatible with the spawnvp()
* provided by the various RTLs. In particular, searching for
* *.{com,bat,cmd} files (as done by the RTLs) is unimplemented.
#else
dTHXo;
DWORD ret;
+ void* env;
+ char* dir;
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInformation;
DWORD create = 0;
? &argv[1] : argv);
char *fullcmd = Nullch;
+ env = PerlEnv_get_childenv();
+ dir = PerlEnv_get_childdir();
+
switch(mode) {
case P_NOWAIT: /* asynch + remember result */
if (w32_num_children >= MAXIMUM_WAIT_OBJECTS) {
NULL, /* thread attributes */
TRUE, /* inherit handles */
create, /* creation flags */
- NULL, /* inherit environment */
- NULL, /* inherit cwd */
+ (LPVOID)env, /* inherit environment */
+ dir, /* inherit cwd */
&StartupInfo,
&ProcessInformation))
{
}
CloseHandle(ProcessInformation.hThread);
+
RETVAL:
+ PerlEnv_free_childenv(env);
+ PerlEnv_free_childdir(dir);
Safefree(cmd);
Safefree(fullcmd);
return (int)ret;