Jump to page: 1 2
Thread overview
Building 32bit program with MSVC?
May 29, 2014
Jeremy DeHaan
May 29, 2014
Remo
May 30, 2014
Mike Parker
May 30, 2014
Kagamin
May 30, 2014
Jeremy DeHaan
May 31, 2014
Kagamin
May 31, 2014
Jonathan M Davis
May 31, 2014
Kagamin
May 31, 2014
Jonathan M Davis
Jun 01, 2014
Daniel Murphy
Jun 04, 2014
Kagamin
May 29, 2014
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 30, 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 31, 2014
They may use different debugging formats, but just linking should be possible, especially with import libraries.
May 31, 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
June 01, 2014
"Jonathan M Davis via Digitalmars-d-learn"  wrote in message news:mailman.1421.1401576730.2907.digitalmars-d-learn@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). 

« First   ‹ Prev
1 2