DUB: How to link an external library on Windows 10?

Mike Parker aldacron at gmail.com
Fri Aug 27 13:33:25 UTC 2021


On Friday, 27 August 2021 at 13:21:04 UTC, Ki Rill wrote:
> I have a Raylib project on Windows using DUB. I've added 
> raylib-d via `dub add`. But what I can't figure out is how to 
> tell DUB to link against raylib library.
>
> I have the following project structure:
> ```
> -> source
> ---> app.d
> -> libraylib.a
> -> raylib.dll
> -> etc...
> ```
>
> I'd like to use either .a or .dll. Do you have any ideas?

raylib.a isn't going to get you anywhere. You'll run into issues 
mixing MinGW-compiled libraries.

If raylib doesn't ship precompiled VS binaries, then, assuming 
you have Visual Studio (or the MS Build tools) installed, you 
should compile Raylib with that same version. Then you'll have a 
new raylib.dll and a raylib.lib. Add raylib.lib to your dub 
config via the "libs" directive.




More information about the Digitalmars-d-learn mailing list