Dub project with .lib/.dlls for static binding
Seb via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Sep 13 22:50:54 UTC 2017
On Wednesday, 13 September 2017 at 19:55:03 UTC, jmh530 wrote:
> I'm not sure this makes much sense, but it's something that's
> been rolling around in my head the past 2-3 days.
>
> One of the great things about Python's Anaconda is that you
> just download one file, install and it just works. In D, dub
> offers comparable functionality as conda, which is very
> helpful. Usually it doesn't take much to get up and running
> with dub. This is especially true with projects that only use D
> code. However, things can get a little more complicated when a
> dub project in turn depends on some C library or something. I
> think this particularly applies to static binding. In my
> experience, it's usually far easier to deal with these sorts of
> issues with Linux than Windows. This additional difficulty
> likely would make it less likely that some Windows user would
> switch from Python to D.
>
> To reduce this difficulty, given some C library that already
> has D bindings available, I would start a separate dub project
> that just includes the .lib or .dlls necessary for Windows.
> Then, a wrapper (or more generally, any library that uses the
> bindings) could then have a dub sub-configuration such that
> Windows requires the previous dub project and uses it for
> dll/libs (also including a switch that would allow the user to
> put the path to them manually).
> This way the user could download the D binding themselves and
> do things manually, or they could use the wrapper and have a
> "just works" experience on Windows (with the option for manual
> customization).
>
> Am I making sense here? Anything I haven't thought of?
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
And for Linux it's even possible to compile small dependencies on
the fly:
https://github.com/dlang-community/drepl/pull/63
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
More information about the Digitalmars-d-learn
mailing list