I really don't understand DUB
Andre Pany
andre at s-e-a-p.de
Sun Apr 14 20:51:10 UTC 2019
On Sunday, 14 April 2019 at 19:46:41 UTC, Ron Tarrant wrote:
> On Monday, 8 April 2019 at 19:54:28 UTC, WhatMeWorry wrote:
>> [...]
>
> Just so you know who I am and what my experience is:
>
> I've only been using D for a few months and so far, I've only
> dabbled in dub. I used to write a blog for PHP-GTK years ago,
> but now I'm writing one based on GtkD.
>
> I was asked early on why I'm not using dub and the short answer
> is: I don't understand it (either).
>
> Today I decided I'd get back to my notes on dub (which is
> leading to a blog post on how to use it) but during a search, I
> turned up a thread on here talking about how dub needs an
> overhaul... or at least, a tune-up.
>
> But I carried on anyway and did a few more experiments with
> dub. However, I ran into a mystery while compiling one of my
> GtkD test files...
>
> The first time I compiled it (using dub, of course) it compiled
> without complaint.
>
> Then I decided to see if I could change the name of the central
> source file from app.d to main.d and added a line to the
> dub.sdl file like this:
>
> mainSourceFile "main.d"
>
> After attempting to compile and realizing this was wrong, I
> read the docs on .sdl files and found that all I had to do is
> change the name of the file. No mention of this change is
> needed in dub.sdl.
>
> So, I tried that and got the warning:
>
> warning LNK4255: library contain multiple objects of the same
> name; linking object as if no debug info
>
> So, I changed it all back to the way it was, but still got the
> warning.
>
> And this warning also comes up whenever I try to compile a
> single-file dub project (where the sdl args are framed in /+ +/
> at the top of file.d).
>
> At that point, with this mystery warning, the talk of dub
> needing an overhaul, and the number of new-ish D programmers
> who just don't understand dub, I decided to, once again, put my
> blog post on dub on the back burner.
>
> All this to say: I feel your pain and hope you can find a way
> to keep on keeping on, with or without dub.
You are totally right, it should be more intuitive how to use dub.
As far as I know if you do not specify in dub.json/dub.sdl what
type of package you have (executable/library) dub make a guess.
Is there an app.d it will default the targetType "executable", if
not it will default the targetType "library".
To solve your specify the targetType explicitly in your dub.sdl
file.
https://dub.pm/package-format-json.html#target-types
Kind regards
Andre
More information about the Digitalmars-d-learn
mailing list