-1

I don't get how standard library like libc is linked.I use MingW compiler. I see that there is no libc.dll file in its bin folder.Then how libc is linked? How does compiler know difference between custom and dynamic library?

1 Answers1

0

We use build tools because they are a practical way to compile code and create executables, deployables etc.

For example. Consider that you have a large Java application consisting of thousands of separate source files split over multiple packages. Suppose that it has a number of JAR file dependencies, some of them for libraries that you have developed, and others for external libraries that can be downloaded from standard places.

You could spend hours manually downloading external JAR files and putting them in the right place. Then you could manually run javac for each of the source files, and jar in multiple times. Each time in the correct directory with the correct command line arguments ... and in the correct order.

And each time you change the source code ... repeat the relevant parts of the above process.

And make sure you don't make a mistake which will cause you to waste time finding test failures, runtime errors, etc caused by not building correctly.

Or ... you could use a build tool that takes care of it all. And does it correctly each time.

In summary, the reasons we use build tools are:

  • They are less work than doing it by hand
  • They are more accurate
  • The results are more reproducible.

I want to know why compiler can't do it?

Because compilers are not designed to perform the entire build process. Just like your oven is not designed to cook a three course meal and serve it up at the dinner table.

A compiler is (typically) designed to compile individual source code files. There is more to building than doing that.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216