A valid code that won't run?

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 24 16:20:23 PDT 2015


On 4/24/15 5:06 PM, Dicebot wrote:
> On Friday, 24 April 2015 at 20:52:16 UTC, Steven Schveighoffer wrote:
>> On 4/24/15 4:36 PM, Dicebot wrote:
>>> On Friday, 24 April 2015 at 20:27:28 UTC, Steven Schveighoffer wrote:
>>>> If pragma(lib, "libcurl"); doesn't work normally, then we should
>>>> remove std.net.curl, and put it in dub.
>>>
>>> It was a historical mistake, discussed many time over and over. Yes, it
>>> shouldn't be in Phobos. No, we can't remove it now that easily.
>>
>> deprecated("Please use dub for curl");
>> module std.net.curl
>
> Not really feasible until dub is part of standard distribution.

Anyone using std.net.curl already is doing non-standard build on Linux. 
And anyone using libcurl on Windows is using whatever DMD provides (do 
we update that to keep up with patches?).

dub is on code.dlang.org, it's not an obscure tool. It takes minutes to 
install dub.

But really, I meant use code.dlang.org, dub shouldn't be a requirement.

libcurl is fine to have as a library with D bindings. But it's not an 
"out of the box" experience. It shouldn't be part of the standard library.

>> You are right about not having pragma(lib anywhere but windows, but we
>> do depend on 3rd party libs -- libc, libm, librt, etc. They are just
>> always in the right places.
>
> It isn't that simple. On Linux it uses gcc for linking making use of the
> fact those libraries are also needed for C applications and system-wide
> installation of GCC already knows it.

Good point.

>> I'm not quite sure where libcurl would be except /usr/lib, and why
>> -L-lcurl wouldn't work (and therefore pragma(lib ). Seems like all the
>> issues are for people who custom-build or custom-install libcurl.
>
> Typical example is when in specific distro library name includes major
> version number in the static library name, i.e. libcurl4.a
> Another case is multilib paths, those are not uniform either (I add
> -L-L/usr/lib32 to default dmd.conf for it to work)
>
> In general the more obscure and less "established" library you want to
> link, the more complicated it is to do in cross-platform way. This is
> why `pragma(lib)` is design failure.

Probably true. It would be nice to be able to configure pragma(lib) 
somehow so it had some input from the environment.

-Steve



More information about the Digitalmars-d mailing list