Skip to content

This is a very small example of how to run C++ modules together with DLLs (on Windows, SO on Linux).

Notifications You must be signed in to change notification settings

maxnevans/cpp_modules_and_dll_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++20 Modules example with DLL

This is an example of C++ modules project with DLL.

1. Set environment variables if you want to compile with a specific compiler (e.g. clang).

Hint. In powershell:

$env:CXX="clang++"
$env:CC="clang"

2. Generate and build the project

mkdir build
cmake -S . -B build
cmake --build build --target main

Hint. If you want clang, use Ninja generator:

Caution

This is not going to compile on Windows. Read the Current problems section about the details of why and how. Though, should compile find on Linux.

make build
cmake -GNinja -S . -B build
cmake --build build --target main

Current problems

1. VS Code doesn't support C++ modules. Syntax highlighting is broken.

Track the issue: Github Issue 6302 - Add IntelliSense for C++20 modules importing

2. Clang as of 17.0.6 and even 18.1.0-rc3 doesn't support STD header units on Windows

import <vector>; - this is going to produce compilation errors. The only possible solution is to use module.modulemap files Stackoverflow Thread.

About

This is a very small example of how to run C++ modules together with DLLs (on Windows, SO on Linux).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published