Executable file & dll process

334 Views Asked by At

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!

3

There are 3 best solutions below

11
On BEST ANSWER

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.

3
On

A truly independent "executable" is an image that you flash onto an embedded device. Your image may (but doesn't need to) bundle a library such as FreeRTOS that functions as a sort of mini-OS. Other than actual hardware, your program will be entirely self-sufficient.

Otherwise, you are at least beholden to having an operating system in place, with access to the "runtime" support library for your language (although this can often be statically linked) and possibly third party libraries on top of that (which may often be statically linked too).

Sometimes when trying to be self-contained, you go so far in the other direction that actually your "program" is not executable at all, but just a script to be passed through a Python or Go or JavaScript or VBScript interpreter. This is in fact the opposite of self-contained, though it is nice and portable if implementations of that language exist on all your target platforms.

Code that runs on a VM (Java, .NET) is a sort of half-way house between these.

4
On

Visual Studio:

Project->'project' Properties

Configuration Properties -> C++ -> Code Generation

Runtime Library -> Multithreaded [debug]

Don't use Multithreaded [debug] DLL

Also, set [debug] for Debug build and NOT [debug] for Release build. You can switch between build types with the 'Configuration' dropdown in the upper left corner.