/*
* "The Road goes ever on and on, down from the door where it began."
*/
-
-
+#define PERLIO_NOT_STDIO 0
#include "EXTERN.h"
#include "perl.h"
return my_perl;
}
+EXTERN_C void
+win32_delete_internal_host(void *h)
+{
+ CPerlHost *host = (CPerlHost*)h;
+ delete host;
+}
+
#ifdef PERL_OBJECT
EXTERN_C void
{
win32_fprintf(stderr, "%s\n",
"Error: Unable to construct data structures");
- CPerlHost* pHost = (CPerlHost*)w32_internal_host;
- Perl_free();
- delete pHost;
- PERL_SET_THX(NULL);
+ perl_free(my_perl);
}
}
perl_free(PerlInterpreter* my_perl)
{
CPerlObj* pPerl = (CPerlObj*)my_perl;
+ void *host = w32_internal_host;
#ifdef DEBUGGING
- CPerlHost* pHost = (CPerlHost*)w32_internal_host;
Perl_free();
- delete pHost;
#else
try
{
- CPerlHost* pHost = (CPerlHost*)w32_internal_host;
Perl_free();
- delete pHost;
}
catch(...)
{
}
#endif
+ win32_delete_internal_host(host);
PERL_SET_THX(NULL);
}
perl_run(PerlInterpreter* my_perl)
{
CPerlObj* pPerl = (CPerlObj*)my_perl;
+ int retVal;
#ifdef DEBUGGING
- return Perl_run();
+ retVal = Perl_run();
#else
- int retVal;
try
{
retVal = Perl_run();
win32_fprintf(stderr, "Error: Runtime exception\n");
retVal = -1;
}
- return retVal;
#endif
+ return retVal;
}
EXTERN_C int
EXTERN_C void
set_w32_module_name(void);
+EXTERN_C void
+EndSockets(void);
+
+
#ifdef __MINGW32__
EXTERN_C /* GCC in C++ mode mangles the name, otherwise */
#endif
* process termination or call to FreeLibrary.
*/
case DLL_PROCESS_DETACH:
+ /* As long as we use TerminateProcess()/TerminateThread() etc. for mimicing kill()
+ anything here had better be harmless if:
+ A. Not called at all.
+ B. Called after memory allocation for Heap has been forcibly removed by OS.
+ PerlIO_cleanup() was done here but fails (B).
+ */
+ EndSockets();
+#if defined(USE_THREADS) || defined(USE_ITHREADS)
+ if (PL_curinterp)
+ FREE_THREAD_KEY;
+#endif
break;
/* The attached process creates a new thread. */