Linking to a library via the linker on Windows?

Jeremy DeHaan dehaan.jeremiah at gmail.com
Wed Nov 20 08:35:51 PST 2013


On Wednesday, 20 November 2013 at 12:02:36 UTC, Mike Parker wrote:
> On 11/20/2013 5:01 PM, Jeremy DeHaan wrote:
>>
>> The -L switch is just for sending switches to the linker. On 
>> OSX and
>> Linux, it is -L-lLibraryName, like I mention before, where 
>> -lLibraryName
>> is what actually gets passed to the linker. Basically I'm 
>> wondering of
>> Optlink has a switch that does the same thing as the -l switch 
>> for
>> linking to a library.
>
> I don't believe there is anything like that. You just pass the 
> lib name.
>
> dmd foo.d bar.lib
>
> You also pass a library path like so:
>
> dmd foo.d bar.lib -L+../path/to/libs
>
> This difference between Windows and other platforms creates a 
> minor annoyance when making cross-platform build scripts for D 
> (which, since dub came along, I don't worry about anymore). I 
> vaguely recall a discussion around here somewhere about having 
> DMD hide all of that behind a uniform syntax on the command 
> line, for the library stuff at least. But it obviously didn't 
> go anywhere.

Ok, thanks. I kind of figured that was the case, but I posted in 
in hopes that there was something that I had missed.



More information about the Digitalmars-d-learn mailing list