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

0xlay Lab 1 Reputation point
2022-06-16T20:00:17.54+00:00

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;  
}  
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,822 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.