How do I run C++ programs in Function Compute?
Function Compute does not include a native C++ runtime. Four approaches let you run C++ code on the platform, each with different trade-offs in implementation effort and runtime performance.
Choose an approach
| Approach | Implementation effort | Performance overhead | Best for |
|---|---|---|---|
| Rewrite in a supported language | Depends on program complexity | Depends on language and scenario | Applications that are not complex |
| Use a custom runtime | Low | Low | All scenarios |
| Call an executable file | Low | High | Latency-insensitive applications, such as asynchronous background file processing |
| Call a shared library | High | Low | High-performance applications |
Not sure which approach fits your situation?
Rewrite in a supported language — Node.js and Python both have rich ecosystems of libraries. If your C++ logic is straightforward, rewriting it in Python is often the fastest path to production.
Use a custom runtime — The lowest-friction option for most teams. Works for virtually any use case. See Overview to get started.
Call an executable file — Compile your C or C++ program as a self-contained executable, then invoke it from a supported-language handler using system calls such as
fork. Simple to set up, but the process-spawn overhead makes this unsuitable for latency-sensitive workloads.Call a shared library — Compile your C or C++ module as a shared library (
.so), then write a Python binding that loads and calls it at runtime.
For a complete list of natively supported languages, see Overview.
Get support
If none of the above approaches resolves your issue, join DingTalk group 64970014484 for technical support.