none
C2980 Compile error porting driver to VS2015 RRS feed

  • Question

  • I am porting an existing WDM driver to VS2015 to create a universal driver.  In some cases objects are instantiated from pre-existing memory, so it is necessary to use the operator new with syntax

    objectptr = new (objectmemoryptr) ClassName

    This requires

    #include <new>

    which results compiler error

    C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\km\crt\new(57): error C2980: C++ exception handling is not supported with /kernel

    Does anyone know how to fix this?

    Thanks,

    Harry

    Tuesday, January 10, 2017 2:54 AM

Answers

  • the header "new" is not KM compatible as it uses native EH. you need to write your own displacement new, which is rather trivial

    PVOID operator new (size_t size, PVOID p) { UNREFERENCED_PARAMETER(size); return p; }


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, January 10, 2017 5:29 AM