Mix C++, C, and Assembly into One Program - Hybrid Program Full Build Tutorial

12 days ago
1

Want to write a single program that uses C++ for high-level logic, C for portability, and assembly for speed? This video shows exactly how to do it.

We build a complete hybrid program from scratch:
- driver.cpp - contains main(), prints intro, calls assembly
- c.c - simple printf() function
- cpp.cpp - C++ function (with extern "C" to disable name mangling)
- hello.asm - assembly module that prints messages, calls C and C++ functions

You?ll see:
- Why hybrid programs matter
- How source files ? object files ? final executable
- The role of the driver and why main() lives once
- Name mangling in C++ and how extern "C" fixes interop
- Global / extern in assembly to expose and call functions
- A clean Makefile that compiles each module separately
- Live build and execution with output explained line-by-line

By the end you?ll know how to call across languages safely, pass basic args via registers, and structure projects for fast incremental builds.

No prior assembly required - just basic C/C++ familiarity. Code is copy-paste ready.

Timestamps in comments. Source files linked below.

Like & subscribe for more systems programming!

What is a Hybrid Program 00:00:00
Why Use Hybrid Programs 00:00:21
Program Modules Overview 00:01:10
Compilation to Object Files 00:02:23
Makefile Introduction 00:04:26
Driver Module Setup 00:06:43
Name Mangling Explained 00:07:18
C++ Module with extern C 00:07:43
Driver Main Function 00:10:12
C Module Implementation 00:11:52
Assembly Module Setup 00:12:41
Assembly Data Section 00:13:03
Assembly Text Section 00:14:18
Global and External Functions 00:14:35
Assembly System Calls 00:16:20
Calling C from Assembly 00:18:58
Calling C++ from Assembly 00:20:32
Program Execution Flow 00:21:05
Running the Program 00:23:59
Passing Arguments Between Modules 00:26:23
Hybrid Program Summary 00:29:11

Thanks for watching!

Find us on other social media here:
- https://www.NeuralLantern.com/social

Please help support us!

- Subscribing + Sharing on Social Media
- Leaving a comment or suggestion
- Subscribing to our Blog
- Watching the main "pinned" video of this channel for offers and extras

Loading comments...