digitalmars.D.learn - Linking on MS Windows.
- ciechowoj (5/5) Aug 05 2016 Is default dmd linker (on MS Windows, OPTILINK) supposed to link
- Jonathan M Davis via Digitalmars-d-learn (17/22) Aug 05 2016 dmc (and thus optlink) and VS use different library formats. So, you can...
- ciechowoj (4/18) Aug 05 2016 Owing to your reply I found this:
- ciechowoj (10/10) Aug 06 2016 I managed to compile both 32 and 64 bit release versions and it
- rikki cattermole (6/9) Aug 06 2016 Optlink does not support 64bit.
- ciechowoj (3/7) Aug 06 2016 That makes sense.
- H.Loom (4/10) Aug 05 2016 No, because DMD win32 produces OMF objects (.lib are archived
- Kai Nacke (5/11) Aug 06 2016 If you are already using Visual Studio and LLVM/clang then why
- ciechowoj (4/6) Aug 06 2016 I'm considering that option. However, as the project I want to
Is default dmd linker (on MS Windows, OPTILINK) supposed to link against static libraries created with Visual Studio? Specifically I want to link a project compiled on windows with dmd against pre-compiled library `libclang.lib` from LLVM suite. I'm pretty sure they used Visual Studio to compile the library.
Aug 05 2016
On Friday, August 05, 2016 18:28:48 ciechowoj via Digitalmars-d-learn wrote:Is default dmd linker (on MS Windows, OPTILINK) supposed to link against static libraries created with Visual Studio? Specifically I want to link a project compiled on windows with dmd against pre-compiled library `libclang.lib` from LLVM suite. I'm pretty sure they used Visual Studio to compile the library.dmc (and thus optlink) and VS use different library formats. So, you can't mix any libraries between them unless you dynamically load them at runtime (which can't be done with a statically linked library). Neither statically linked libraries nor dynamically linked libraries compiled by one compile can be mixed with those from the other. I know that dmd supports VS' binary format and linker for 64-bit (dmc and optlink were never updated to support 64-bit), and I think that 32-bit support for using VS' library format and linker were added later. So, I'm fairly certain that you could compile your D program to be compatible with that statically linked library by using the right compiler flag with dmd. But I don't use Windows much aside from work, so I'm not very familiar with how to use dmd with Windows beyond the basics and am not going to be very helpful in telling you how to actually do it. You might be able to figure it out by looking at dmd's compiler flags, but if not, I'm sure that someone else here who actually uses Windows with D will be able to tell you. - Jonathan M Davis
Aug 05 2016
On Friday, 5 August 2016 at 18:37:43 UTC, Jonathan M Davis wrote:I know that dmd supports VS' binary format and linker for 64-bit (dmc and optlink were never updated to support 64-bit), and I think that 32-bit support for using VS' library format and linker were added later. So, I'm fairly certain that you could compile your D program to be compatible with that statically linked library by using the right compiler flag with dmd. But I don't use Windows much aside from work, so I'm not very familiar with how to use dmd with Windows beyond the basics and am not going to be very helpful in telling you how to actually do it. You might be able to figure it out by looking at dmd's compiler flags, but if not, I'm sure that someone else here who actually uses Windows with D will be able to tell you. - Jonathan M DavisOwing to your reply I found this: http://stackoverflow.com/questions/36332219/linking-with-c-libraries-on-windows-with-dub And it even seems to work. Thanks.
Aug 05 2016
I managed to compile both 32 and 64 bit release versions and it seems to work fine, however with 64-bit debug version I'm getting a strange error: LINK : fatal error LNK1101: incorrect MSPDB120.DLL version; recheck installation of this product Does anyone know why it is so? I'm compiling with -m64 switch, so I suppose the linker from Visual Studio is used by default. Another question that is troubling me is why to use OPTLINK as a default for 32-bit version, if for 64-bit version a Visual Studio linker is used anyway?
Aug 06 2016
On 06/08/2016 11:53 PM, ciechowoj wrote:Another question that is troubling me is why to use OPTLINK as a default for 32-bit version, if for 64-bit version a Visual Studio linker is used anyway?Optlink does not support 64bit. For 64bit support we use the MSVC tooling on Windows. We provide Optlink so that we have support for Windows out of the box. Unfortunately since Optlink does not understand COFF, we are forced to provide a second command option to force MSVC tooling for 32bit usage.
Aug 06 2016
On Saturday, 6 August 2016 at 11:58:31 UTC, rikki cattermole wrote:We provide Optlink so that we have support for Windows out of the box. Unfortunately since Optlink does not understand COFF, we are forced to provide a second command option to force MSVC tooling for 32bit usage.That makes sense.
Aug 06 2016
On Friday, 5 August 2016 at 18:28:48 UTC, ciechowoj wrote:Is default dmd linker (on MS Windows, OPTILINK) supposed to link against static libraries created with Visual Studio? Specifically I want to link a project compiled on windows with dmd against pre-compiled library `libclang.lib` from LLVM suite. I'm pretty sure they used Visual Studio to compile the library.No, because DMD win32 produces OMF objects (.lib are archived collection of objects) while VS will produce collection of COFF in the lib.
Aug 05 2016
On Friday, 5 August 2016 at 18:28:48 UTC, ciechowoj wrote:Is default dmd linker (on MS Windows, OPTILINK) supposed to link against static libraries created with Visual Studio? Specifically I want to link a project compiled on windows with dmd against pre-compiled library `libclang.lib` from LLVM suite. I'm pretty sure they used Visual Studio to compile the library.If you are already using Visual Studio and LLVM/clang then why not use ldc? The compiler itself is built with this toolchain... Regards, Kai
Aug 06 2016
On Saturday, 6 August 2016 at 12:06:02 UTC, Kai Nacke wrote:If you are already using Visual Studio and LLVM/clang then why not use ldc? The compiler itself is built with this toolchain...I'm considering that option. However, as the project I want to compile is dstep, I want it to compile smoothly with dmd. Any ideas about that strange liker error?
Aug 06 2016