From 0163cf45463a40cd0b4f7393e11fc0a180dc7b16 Mon Sep 17 00:00:00 2001 From: ageay Date: Tue, 21 Sep 2010 11:23:06 +0000 Subject: [PATCH] Before windows test. --- .../ExprEval/InterpKernelExprParser.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx index 704b6afc8..585fac2f8 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx @@ -31,6 +31,9 @@ #ifdef _POSIX_MAPPED_FILES #include #else +#ifdef WNT +#include +#endif #endif using namespace INTERP_KERNEL; @@ -721,9 +724,14 @@ char *ExprParser::compileX86() const char *ret=0; #ifdef _POSIX_MAPPED_FILES ret=(char *)mmap(0,lgth,PROT_EXEC | PROT_WRITE,MAP_ANONYMOUS | MAP_PRIVATE,-1,0); - std::copy(lm,lm+lgth,ret); #else +#ifdef WNT + HANDLE h=CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_EXECUTE_READWRITE,0,lgth,NULL); + ret=(char *)MapViewOfFile(h,FILE_MAP_EXECUTE | FILE_MAP_READ | FILE_MAP_WRITE,0,0,lgth); +#endif #endif + if(ret) + std::copy(lm,lm+lgth,ret); delete [] lm; return ret; } @@ -754,9 +762,14 @@ char *ExprParser::compileX86_64() const char *ret=0; #ifdef _POSIX_MAPPED_FILES ret=(char *)mmap(0,lgth,PROT_EXEC | PROT_WRITE,MAP_ANONYMOUS | MAP_PRIVATE,-1,0); - std::copy(lm,lm+lgth,ret); #else +#ifdef WNT + HANDLE h=CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_EXECUTE_READWRITE,0,lgth,NULL); + ret=(char *)MapViewOfFile(h,FILE_MAP_EXECUTE | FILE_MAP_READ | FILE_MAP_WRITE,0,0,lgth); +#endif #endif + if(ret) + std::copy(lm,lm+lgth,ret); delete [] lm; return ret; } -- 2.39.2