There is the possibility of “hiding” the implementation of something inside a pre-built library file.
Say if you have
void super_secret_logic() {
//..
}
then you can compile that C/C++ file to a static library, say libSecret.a
, and link it in the project (-lSecret
). The project then does not require the C/C++ source file anymore, only the header declaring the function. The implementation will be found in the precompiled file.
Note that techniques exists to extract the original C code back from the precompiled library file, that’s called “Reverse Engineering”. Tools like “IDA Pro” and “Ghidra” do a very good job at this. If someone wants to know the logic implemented in a library, they will find it out, only a matter of time. It’s only good enough to push the “casual users” away to look into the implementation.
I’ve written a tutorial on this in How to generate and use pre-compiled objects - #2 by maxgerhardt.