digitalmars.D.learn - Building 32bit program with MSVC?
- Jeremy DeHaan (2/2) May 29 2014 I know that we can use MSVC to build a 64 bit program, but is it
- Remo (3/5) May 29 2014 Yes of course it is possible.
- Jonathan M Davis via Digitalmars-d-learn (11/16) May 29 2014 If you are talking about building a 32-bit program with dmd and linking ...
- Mike Parker (4/6) May 30 2014 If you mean using the MSVC toolchain with DMD, then the answer is no,
- Kagamin (2/2) May 30 2014 You can try ldc, which uses mingw toolchain, it's probably
- Jeremy DeHaan (5/7) May 30 2014 I don't necessarily need to do this, I was just wondering if it
- Kagamin (2/2) May 30 2014 They may use different debugging formats, but just linking should
- Jonathan M Davis via Digitalmars-d-learn (5/7) May 31 2014 On Sat, 31 May 2014 06:38:46 +0000
- Kagamin (2/2) May 31 2014 By dynamic linking do you mean LoadLibrary or linking with import
- Jonathan M Davis via Digitalmars-d-learn (9/11) May 31 2014 On Sat, 31 May 2014 07:53:40 +0000
- Daniel Murphy (11/19) May 31 2014 The big issue with static linking is sharing the c runtime, which you ca...
- Kagamin (3/3) Jun 04 2014 LLVM never supported OMF. LDC uses msvcrt runtime, and MS claims
I know that we can use MSVC to build a 64 bit program, but is it also possible to use it to build a 32 bit program as well?
May 29 2014
On Thursday, 29 May 2014 at 18:25:19 UTC, Jeremy DeHaan wrote:I know that we can use MSVC to build a 64 bit program, but is it also possible to use it to build a 32 bit program as well?Yes of course it is possible. It you are talking about Visual-D then it is possible there too.
May 29 2014
On Thu, 29 May 2014 20:12:52 +0000 Remo via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:On Thursday, 29 May 2014 at 18:25:19 UTC, Jeremy DeHaan wrote:If you are talking about building a 32-bit program with dmd and linking with Microsoft's linker, it's my understanding that that will not work, because dmd always produces OMF object files in 32-bit (which is what optlink uses), whereas dmd produces COFF object files in 64-bit (which is what Microsoft's linker uses). Walter went to the trouble of getting dmd to produce COFF object files to link with Microsoft's linker when he added 64-bit Windows support but did not want to go to the trouble of adding COFF support to 32-bit. - Jonathan M DavisI know that we can use MSVC to build a 64 bit program, but is it also possible to use it to build a 32 bit program as well?Yes of course it is possible. It you are talking about Visual-D then it is possible there too.
May 29 2014
On 5/30/2014 3:25 AM, Jeremy DeHaan wrote:I know that we can use MSVC to build a 64 bit program, but is it also possible to use it to build a 32 bit program as well?If you mean using the MSVC toolchain with DMD, then the answer is no, not at the moment. Rainer has done some work toward this, though. I recall seeing it brought up again in a recent thread.
May 30 2014
You can try ldc, which uses mingw toolchain, it's probably compatible with msvc.
May 30 2014
On Friday, 30 May 2014 at 20:48:44 UTC, Kagamin wrote:You can try ldc, which uses mingw toolchain, it's probably compatible with msvc.I don't necessarily need to do this, I was just wondering if it was possible. Mostly because MSVC provides a lot of import and static libraries that DMC doesn't, and MSVC is supported in a lot of major tools(such as CMake) where DMC isn't.
May 30 2014
They may use different debugging formats, but just linking should be possible, especially with import libraries.
May 30 2014
On Sat, 31 May 2014 06:38:46 +0000 Kagamin via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:They may use different debugging formats, but just linking should be possible, especially with import libraries._Dynamic_ linking is possible. Static linking is not. - Jonathan M Davis
May 31 2014
By dynamic linking do you mean LoadLibrary or linking with import library?
May 31 2014
On Sat, 31 May 2014 07:53:40 +0000 Kagamin via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote: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. - Jonathan M Davis
May 31 2014
"Jonathan M Davis via Digitalmars-d-learn" wrote in message news:mailman.1421.1401576730.2907.digitalmars-d-learn puremagic.com...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).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.
May 31 2014
LLVM never supported OMF. LDC uses msvcrt runtime, and MS claims that whatever can link with msvcrt, it also can link with later versions of msvcrt.
Jun 04 2014