Testcontainers Native

Under the Hood

qianmoQqianmoQ· 更新于 2026-10-19· 阅读 4 分钟· 0 次阅读

登录后可跨设备保存划线和私人笔记登录

Architecture

[!NOTE] This section is coming soon. All contributions are welcome, just submit a pull request!

Build Process

Testcontainers Native Build Process

Stage 1. Testcontainers for C Bridge library

The core testcontainers-bridge shared library is built with Cgo. For that the -buildmode=c-shared is used in the Golang builder, and it also receives a customized header so that the types can be mapped between C and Golang. We also have to flatten the structure and to switch the reference-based build process to fixed Objects stored in the Golang namespace, and C API using unique object IDs.

Stage 2. Testcontainers for C shared library

As Cgo cannot produce fancy headers and structure, we have a manually created header file that wraps core functionality of tescontainers-bridge. This provides a static library and header files that can be used natively in C/C++ development, or by language bindings.

Stage 3. Language Bindings

Then, we build custom binding libraries, by using Testcontainers for C as a static library that is bundled into the language specific libs. This stage depends on the language and common practices there.

Stage 4. Executable Code

Well, you build it. From the previous stages, you get a header file, binding libraries, a shared library object or a DLL file from the Testcontainers for C module. Then, you know the drill.

评论

登录后参与评论

正在加载评论…