Dub project with .lib/.dlls for static binding

jmh530 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 14 03:58:43 UTC 2017


On Wednesday, 13 September 2017 at 22:50:54 UTC, Seb wrote:
>
> No you are not, it's just currently a bit painful to do 
> manually due to e.g. missing support for git submodules.
> However, some projects already do this:
>
> Windows: https://github.com/ariovistus/pyd/blob/master/dub.json

I was not aware that pyd does that, but it is very similar to 
what I'm saying.

The difference would be to put the .lib files in a separate dub 
project. Instead of having the dub.json pointing to the location 
of the lib files within the pyd project, there would be a 
dependency on the lib project and a link to the files within that.

I suppose there is no real reason why there needs to be a 
wrapper. This behavior can get added to D bindings.

Regardless, I suppose the main motivation of not putting it in 
the bindings is that if someone is using the library on Linux, 
then they don't need to download any of the Windows lib files. 
The only change would be a small change to the dub.json to 
account for the different Windows behavior.

>
> And for Linux it's even possible to compile small dependencies 
> on the fly:
>
> https://github.com/dlang-community/drepl/pull/63

I'm specifically interested in good support for Windows.

>
> Imho if the library is small, compiling it (or using prebuilt 
> for Windows), should be the default behavior because it's a 
> very pleasant user experience

I'm 100% pro-"very pleasant user experience." The problem is that 
it usually isn't on Windows in this case. You often have to go 
find the library yourself and existing pre-built ones may not be 
in the right format (How were they compiled? MinGW or MSVC? What 
linker? Etc) so you have to go build it yourself. Deimos 
projects, for instance, are just C headers and D bindings. No 
.lib files.


More information about the Digitalmars-d-learn mailing list