Building 32bit program with MSVC?
Daniel Murphy via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat May 31 17:59:56 PDT 2014
"Jonathan M Davis via Digitalmars-d-learn" wrote in message
news:mailman.1421.1401576730.2907.digitalmars-d-learn at puremagic.com...
> > By dynamic linking do you mean LoadLibrary or linking with import
> > library?
>
> Both will work, otherwise we couldn't use Microsoft's libraries - e.g.
> std.windows.registry uses advapi32.dll to talk to the registry. But static
> linking requires that the library formats match. However, I'm afraid that
> I
> don't know enough about how linking works to know why that's a problem for
> static linking and not for dynamic linking.
The big issue with static linking is sharing the c runtime, which you can
avoid if you're using dlls. Import libs only contain a mapping from mangled
name to exported name (or ordinal) and this can easily be converted from one
library format to another.
In some very simple cases it _is_ possible to convert COFF (msvc) to OMF
(dmc) object files and static libraries, but as soon as msvc inserts
anything msvc-runtime specific it will fail miserably. Some examples are
stack-check functions, special sections, runtime built-ins (eg 64-bit divide
on some platforms).
More information about the Digitalmars-d-learn
mailing list