Ngôn ngữ lập trình C++ cho phép nhúng mã nguồn của ngôn ngữ lập trình C vào trong nó.
Ngôn ngữ lập trình C++ xài từ khóa extern C để chén mã nguồn C vào.
1 ví dụ về C++ nhúng C là trong Node.js
extern "C" {
// This symbol must be declared weak because this file becomes part of all
// Node.js targets (like node_mksnapshot, node_mkcodecache, and cctest) and
// those files do not supply the symbol.
extern char __attribute__((weak)) __node_text_start;
extern char __start_lpstub;
} // extern "C"
https://github.com/nodejs/node/blob/main/src/large_pages/node_large_page.cc
Mời các bạn coi video về Node.js xài Transparent Huge Pages để biết Node.js viết bằng ngôn ngữ lập trình C++ có nhúng mã nguồn ngôn ngữ lập trình C trong nó.