[Info] MD vs MT && Unicode vs ANSI

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
kyuuuri
Posts: 321
Joined: 09 Jan 2016, 19:20

[Info] MD vs MT && Unicode vs ANSI

03 Mar 2020, 01:54

/MD (Multi-threaded DLL) versions

When compiling with /MD it means that the dlls are not included with the .exe, that's why you have to distribute vcruntime140.dll with the exe (unless the user has Visual C++ Redistributable for Visual Studio 2015 installed)

Pros:
  • The dll is exposed to system updates
  • The executable will be smaller.
  • The code segment of a DLL is shared amongst all processes that are actively using it (reducing the total amount of RAM consumed).
  • Will allow to modify/delete/create memory from dll in exe, exe in dll and dll in dll,
Cons:
  • The dll is exposed to system updates which can break your exe.
  • You need to distribute the dll with the exe.
/MT (Multi-threaded) versions

When compiling with /MT it means that the dlls are included with the .exe.

Pros:
  • You don't need to distribute the dll with the exe.
Cons:
  • The executable is bigger.
  • It will use more RAM.
  • It is very likely to cause memory leaks and crash your exe. (CriticalObject, VirtualAlloc, HeapAlloc, etc.)
  • The dll is not exposed to system updates.
ANSI vs Unicode
  1. Both are character encodings (actually Unicode refers to the character set), ANSI is very old while Unicode is the current standard we use today.
  2. ANSI programs are slower than Unicode.
  3. Unicode programs won't work on old computers.
  4. With your ANSI exe you won't be able to use characters like "Ç" or "Ñ"
SOTE
Posts: 1035
Joined: 15 Jun 2015, 06:21

Re: [Info] MD vs MT && Unicode vs ANSI

10 Mar 2020, 10:44

In regards to MD vs MT, what you are saying are cons, may not be viewed as such by everyone.

1. In the year 2020, with people having terabyte sized drives, a difference of 1MB or less is often inconsequential.

2. That a program uses slightly more memory, in say a 8GB to 16GB RAM having desktop computer, is also arguably inconsequential.

3. Many people don't want the application they send out to others to be exposed to updates, as they aren't actively supporting it. Even if they are, they can recompile a new version that will upgrade the old version of the app.

4. Memory leaks would be the best argument, but this would also be relative to the skill of the programmer and depend on the type of the application. The type of application created may not have memory issues or the code in it is constructed so that the total amount of RAM used is monitored and limited.

I'm not saying that MD or MT is superior to the other, rather it's much more about the preference of the author creating the application.
User avatar
Tomer
Posts: 314
Joined: 21 Aug 2016, 05:11

Re: [Info] MD vs MT && Unicode vs ANSI

24 Mar 2020, 07:25

Thanks for the info!

Return to “AutoHotkey_H”

Who is online

Users browsing this forum: No registered users and 2 guests