 #include <fstream>
 #include <string.h>
 #include <cctag/cuda/cctag_cuda_runtime.h>
+#ifdef _MSC_VER
+#include <windows.h>
+#else
 #include <sys/mman.h>
+#endif
 #include "debug_macros.hpp"
 #include "pinned_counters.h"
 

    // pin the image to memory
    _image_to_upload = image;

    mlock( _image_to_upload, getWidth() * getHeight() );

    POP_CUDA_MEMCPY_2D_ASYNC( _d_plane.data,
                              getPitch(),

{
    // unpin the image
    if( _image_to_upload != 0 ) {
#ifdef _MSC_VER
        VirtualUnlock(LPVOID(_image_to_upload), (getWidth() * getHeight()));
#else
        munlock( _image_to_upload, getWidth() * getHeight() );
#endif
        _image_to_upload = 0;
    }
}
