Computer science: compilation games

Self-tutoring about computer science: the tutor mentions an observation.

I am working on a project that uses an external library. To begin, I wanted to test if the library would compile as presented. I wrote a program that includes its header file and its own libraries but doesn’t directly use it, just to see if it would compile.

Interestingly, it didn’t. Moreover, I got an error message complaining a certain entity wasn’t defined which I could see defined in the lead header file.

Situations like this aren’t uncommon in computer science, because there are often subtleties to how things work. I was unfamiliar with this compiler.

It turns out that the compiler may let go of a function not invoked by the program being compiled. Because I had added a header file that my program wasn’t using, the compiler decided to drop a function from it. That function was needed by a downstream dependency, which complained it couldn’t find it. Yet, my program never invoked that dependency. Therefore, the compiler wouldn’t successfully compile my program.

I added functionality to my program so that it did invoke a function from the included library. Then, it compiled. Interesting, eh?


Tao’s Blog

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply