Book Image

Extreme C

By : Kamran Amini
5 (1)
Book Image

Extreme C

5 (1)
By: Kamran Amini

Overview of this book

There’s a lot more to C than knowing the language syntax. The industry looks for developers with a rigorous, scientific understanding of the principles and practices. Extreme C will teach you to use C’s advanced low-level power to write effective, efficient systems. This intensive, practical guide will help you become an expert C programmer. Building on your existing C knowledge, you will master preprocessor directives, macros, conditional compilation, pointers, and much more. You will gain new insight into algorithm design, functions, and structures. You will discover how C helps you squeeze maximum performance out of critical, resource-constrained applications. C still plays a critical role in 21st-century programming, remaining the core language for precision engineering, aviations, space research, and more. This book shows how C works with Unix, how to implement OO principles in C, and fully covers multi-processing. In Extreme C, Amini encourages you to think, question, apply, and experiment for yourself. The book is essential for anybody who wants to take their C to the next level.
Table of Contents (23 chapters)

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...