Search code examples
windowsoperating-systemhexmachine-instruction

Executable file & dll process


What kind of software or programming language that I've to learn for creating single executable program without any .dll or other formats independently?

Any suggestion I would appreciate!


Solution

  • It is operating system specific (and not defined by the language itself). Read more about linkers.

    You may want to use C++11 (or C++14) and instruct your C++ compiler to statically link your executable. So you should read the documentation of your compiler; with GCC you could pass -static to the g++ command.

    You may also want to use the Go language. The usual compiler for Go is trying to generate statically linked executables.

    BTW, a statically linked executable still have dependencies, e.g. to its operating system kernel (and perhaps utilities and some system files) : obviously, a statically linked executable for Windows won't run on Linux.

    (for instance, on Linux, any program using the standard system(3) function silently depends upon /bin/sh....)

    In practice, I generally would not recommend statically linking the C standard library, but YMMV.

    Of course, you need some source code editor to write your code (I prefer GNU emacs). Some people are using IDEs, but I prefer to run explicitly the compilation command (perhaps using some build automation tool like GNU make).

    (notice that DevC++ or CodeBlocks is an IDE, not a compiler)

    NB: I recommend reading Operating Systems : Three Easy Pieces (freely downloadable, each chapter has its own PDF file) to understand more about operating systems.