On 27/09/16 04:27, Mike Crawford wrote:
> Please forgive me as this is obviously a frequently asked question.
> However I'm unable to find the answer with a search engine.
Better to ask, than to blindly follow potentially misleading info on
some random, ill-informed web site; (yes, StackOverflow, I hold you
accountable for a great deal of ill-informed rubbish).
> I want to build libbz2.dll - the BZip2 library as a Windows DLL.
> It compiles just fine but I'm unclear what to put in my makefile so
> that ld finds a C Runtime.
If you are using MinGW, you don't need to add *anything*; just use gcc
or g++ (*not* ld) to invoke the linker, and it will specify MSVCRT.DLL
automatically (by default).
> There is a blog at Microsoft that discourages linking to
This may be a valid concern, *if* you are using Microsoft's compiler;
(you do *not* want to mix MSVCRT.DLL and the (non-free) runtime which
accompanies that (equally non-free) compiler). Since you are using
MinGW, that discouragement is no more than Microsoft brainwashing.
: Before some smart Alec points out that there are zero-price ways
to acquire Microsoft compilers, please remember that they are still
encumbered by restrictive EULAs. Zero-price != free.
> Am I to link to it anyway?
> If so how do I do it?
Use gcc, (or g++, if your application is C++), or any of the other
GCC compiler language drivers, (as appropriate), as the command to link
your application, and it will be done automatically. (Do *not* invoke
ld directly; that doesn't comprehend the library dependencies).
> Is there some other runtime I should use?
> If so can I statically link it or must I distribute the runtime's
> DLL with my installer?
You cannot do that legally, (for MSVCRT.DLL); nor do you need to, since
it is already distributed as an OS component. There is one issue you
may need to consider: MSVCRT.DLL has evolved with Windows itself; if you
use features added by a recent Windows OS version, your application may
not run on an older Windows version.
: There may be other, usage related issues, (e.g. within MSVCRT.DLL,
time_t means 32-bit time, irrespective of _USE_32BIT_TIME_T); however,
these are separate from the issues of linking and distribution.
Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)