Thread overview
Trouble linking to static library with Visual D
Aug 02, 2014
quakkels
Aug 02, 2014
Rainer Schuetze
Aug 02, 2014
quakkels
August 02, 2014
Hello D'ers,

I've been really impressed with Visual D and I've decided to undertake my first D project using Visual D in Visual Studio 2012. However, I've had trouble trying to figure out how to link a static library.

I've outlined my situation in this Stack Overflow question.

    http://stackoverflow.com/questions/25071649/how-to-link-to-packages-in-static-libraries-using-visual-d

I would very much appreciate any insight into what I can do to correct the described behavior.

Thanks,
quakkels
August 02, 2014

On 02.08.2014 04:43, quakkels wrote:
> Hello D'ers,
>
> I've been really impressed with Visual D and I've decided to undertake
> my first D project using Visual D in Visual Studio 2012. However, I've
> had trouble trying to figure out how to link a static library.
>
> I've outlined my situation in this Stack Overflow question.
>
> http://stackoverflow.com/questions/25071649/how-to-link-to-packages-in-static-libraries-using-visual-d
>
>
> I would very much appreciate any insight into what I can do to correct
> the described behavior.
>
> Thanks,
> quakkels

Your request.d should declare the full module name including the package:

module codecramlib.http.request;

Then import it with this name from package.d:

import codecramlib.http.request;

When you get to the link stage, you'll probably run into undefined symbols: you'll have to add a dependency in the "Project Dependencies" dialog to add the static library to the linker command line of the executable.
August 02, 2014
> When you get to the link stage, you'll probably run into undefined symbols: you'll have to add a dependency in the "Project Dependencies" dialog to add the static library to the linker command line of the executable.

Thank you for that tip! After a fair bit of frustration (and your help) I've finally got it working!