Can't compile driver project in Visual Studio 2019 with C++20 modules

169 Views Asked by At

Does the MSVC support C++20 modules for Windows driver projects ?

I enabled C++20 and compiled project, but I taked error (C3474 could not open file DriverModule.ifc). I tried to added path in "[Additional Module dependecies]: $(ProjectDir)DriverModule.ifc", but it wasn't fixing error.

DriverModule.ixx

export module DriverModule;

export int calculate(int x);

DriverModule.cpp

module DriverModule;

int calculate(int x)
{
    return x + 10;
}

EntryPoint.cpp

#include <wdm.h>
import DriverModule;

extern "C" NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath);

NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
    UNREFERENCED_PARAMETER(DriverObject);
    UNREFERENCED_PARAMETER(RegistryPath);
    int b = calculate(28);
    KdPrint(("%d", b));
    return STATUS_SUCCESS;
}
0

There are 0 best solutions below