Skip to content

Commit 8d0b5a7

Browse files
Merge pull request #35 from testcontainers/architecture
Add initial project architecture overview
2 parents bf9535a + 257932d commit 8d0b5a7

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,24 @@ See [the examples and demos](./demo/README.md) for more examples.
6666
### Using in other languages
6767

6868
TL;DR: You get the C header file, a shared library object or a DLL file from the
69-
[Testcontainers for C](./docs/c/README.md) module,
70-
Then, you know the drill.
69+
[Testcontainers for C](./docs/c/README.md) module.
70+
Then, you can bind this native library in your project type.
71+
It allows supporting many other languages that support using
72+
native tooling via dynamically or statically linked libraries:
73+
74+
![Languages that can leverage Testcontainers for C](docs/images/supported-languages.png)
75+
76+
Disclaimer:
77+
The schema above shows the most popular languages for Embedded systems,
78+
based on the
79+
[IEEE Spectrum 2021 Report](https://spectrum.ieee.org/top-programming-languages-2021)
80+
and the [JetBrains 2021 Developer Ecosystem Survey for Embedded Software](https://www.jetbrains.com/lp/devecosystem-2021/embedded/).
81+
More native languages exist and can be supported by Testcontainers Native.
82+
7183
Feel free to contribute examples or SDKs for the languages!
84+
See the [Swift Solution Page](./docs/swift/README.md) for examples.
85+
[Testcontainers Native Architecture](./docs/architecture/README.md)
86+
describes how it can be done in principle.
7287

7388
## Credits
7489

docs/architecture/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,29 @@
33
!!! note
44
This section is coming soon.
55
All contributions are welcome, just submit a pull request!
6+
7+
## Build Process
8+
9+
![Testcontainers Native Build Process](./images/build-process.png)
10+
11+
### Stage 1. Testcontainers for C shared library
12+
13+
The core `testcontainers-c` shared library is built with [Cgo](https://pkg.go.dev/cmd/cgo).
14+
For that the `-buildmode=c-shared` is used in the Golang builder,
15+
and it also receives a customized header so that the types can be mapped between C and Golang.
16+
For that, 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
17+
using unique object IDs.
18+
19+
### Stage 2. Language Bindings
20+
21+
Then, we build custom binding libraries, by using Testcontainers for C
22+
as a static library that is bundled into the language specific libs.
23+
This stage depends on the language and common practices there.
24+
25+
### Stage 3. Executable Code
26+
27+
Well, you build it.
28+
From the previous stages,
29+
you get a header file, binding libraries,
30+
a shared library object or a DLL file from the [Testcontainers for C](./docs/c/README.md) module.
31+
Then, you know the drill.
114 KB
Loading
136 KB
Loading

0 commit comments

Comments
 (0)