O'Reilly logo

Head First C by Dawn Griffiths, David Griffiths

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Static and Dynamic Libraries: Hot-swappable code

image with no caption

You’ve already seen the power of standard libraries.

Now it’s time to use that power for your own code. In this chapter, you’ll see how to create your own libraries and reuse the same code across several programs. What’s more, you’ll learn how to share code at runtime with dynamic libraries. You’ll learn the secrets of the coding gurus. And by the end of the chapter, you’ll be able to write code that you can scale and manage simply and efficiently.

Code you can take to the bank

Do you remember the encrypt() function you wrote a while back that encrypted the contents of a string? It was in a separate source code file that could be used by several programs:

image with no caption

Somebody else has written a function called checksum() that can be used to check if the contents of a string have been modified. Encrypting data and checking if data has been modified are both important for security. Separately, the two functions are useful, but together they could form the basis of a security library.

image with no caption
image with no caption

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required