Thread overview
D static library on Windows 64 problem
January 02
I'm stepping through the windows static library tutorial at

http://prowiki.org/wiki4d/wiki.cgi?D__Tutorial/CompilingLinkingD#Linkingmanually

```
The fix is to specify the prebuilt .lib file on the command line:

    dmd driver.d %cd%\libs\libfoo\libfoo.lib
```

The tutorial is for 32 bit so it uses OPTLINK.  I'm using 64 bits so it uses Microsoft's link.exe  When I try

dmd -m64 -v driver.d -L=/LIBPATH:"c:\dev\LibraryStudy\StaticLibrary\libfoobar"

I get this monstrosity

link.exe /NOLOGO "driver.obj"   /DEFAULTLIB:phobos64 /LIBPATH:"c:\dev\LibraryStudy\StaticLibrary\libfoobar" /OPT:NOICF 
 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\lib\x64" legacy_stdio_definitions.lib /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64"

which I think would work except for the fact the path argument looses its double quotes.

Is there a fix?

I tried invoking link.exe directly with the ""s added manually, but then link.exe complains that phobos64.lib can't be found.

January 02
On Saturday, 2 January 2021 at 22:04:28 UTC, WhatMeWorry wrote:
> I'm stepping through the windows static library tutorial at
>
> http://prowiki.org/wiki4d/wiki.cgi?D__Tutorial/CompilingLinkingD#Linkingmanually
>
> [...]

Oops. used the manual example.  Should be /LIBPATH:c:\dev\LibraryStudy\StaticLibrary\libfoobar
January 03
On Saturday, 2 January 2021 at 22:08:34 UTC, WhatMeWorry wrote:
> On Saturday, 2 January 2021 at 22:04:28 UTC, WhatMeWorry wrote:
>> I'm stepping through the windows static library tutorial at
>>
>> http://prowiki.org/wiki4d/wiki.cgi?D__Tutorial/CompilingLinkingD#Linkingmanually
>>
>> [...]
>
> Oops. used the manual example.  Should be /LIBPATH:c:\dev\LibraryStudy\StaticLibrary\libfoobar

If it doesn't say so on the wiki (haven't read), could you update it with your findings? Thanks!
January 04
On Sunday, 3 January 2021 at 15:49:03 UTC, Imperatorn wrote:
> On Saturday, 2 January 2021 at 22:08:34 UTC, WhatMeWorry wrote:
>> On Saturday, 2 January 2021 at 22:04:28 UTC, WhatMeWorry wrote:
>>> I'm stepping through the windows static library tutorial at
>>>
>>> http://prowiki.org/wiki4d/wiki.cgi?D__Tutorial/CompilingLinkingD#Linkingmanually
>>>
>>> [...]
>>
>> Oops. used the manual example.  Should be /LIBPATH:c:\dev\LibraryStudy\StaticLibrary\libfoobar
>
> If it doesn't say so on the wiki (haven't read), could you update it with your findings? Thanks!

I'm sorry. The correction was for my first post, not the tutorial. If the tutorial was written for 64 bits I wouldn't be having this problem :)