Summary
In this chapter, we went through the integration of C within other programming languages. As part of this chapter:
- We designed a C library that was exposing some stack functionality such as push, pop, and so on. We built the library and as the final output we generated a shared object library to be used by other languages.
- We discussed the name mangling feature in C++, and how we should avoid it in C when using a C++ compiler.
- We wrote a C++ wrapper around the stack library that could load the library's shared object file and execute the loaded functionalities within C++.
- We continued by writing a JNI wrapper around the C library. We used native methods to achieve that.
- We showed how to write native code in JNI and connect the native part and Java part together, and finally run a Java program that uses the C stack library.
- We managed to write Python code that was using the ctypes package to load and use the library's shared object...