April 24, 2015
On Friday, 24 April 2015 at 20:52:16 UTC, Steven Schveighoffer wrote:
>> There is a reason nothing but Windows build of DMD supports it.
>
> You are right about not having pragma(lib anywhere but windows,


pragma(lib) works on all versions of dmd, including on Linux.
April 24, 2015
On Friday, 24 April 2015 at 21:47:50 UTC, cym13 wrote:
> Reimplementing sure sounds like the best long-term way to go...
> Maybe we don't need all libcurl features

Actually, I find curl doesn't provide much of what I actually need and I have to build stuff on top of it!

But the hard part to reimplment isn't basic get stuff... the hard part is the encrypted sockets, and you're still likely going to depend on a third party library for them....
April 24, 2015
On Friday, 24 April 2015 at 21:06:59 UTC, Dicebot wrote:
>
> Typical example is when in specific distro library name includes major version number in the static library name, i.e. libcurl4.a

Isn't this very problem why pkg-config exists?

> Another case is multilib paths, those are not uniform either (I add -L-L/usr/lib32 to default dmd.conf for it to work)
>
Yeah, I don't think they ever made it better at dealing with that; have to set PKG_CONFIG_PATH.  (But that's multilib for you.)

-Wyatt
April 24, 2015
On 4/24/15 6:03 PM, Adam D. Ruppe wrote:
> On Friday, 24 April 2015 at 20:52:16 UTC, Steven Schveighoffer wrote:
>>> There is a reason nothing but Windows build of DMD supports it.
>>
>> You are right about not having pragma(lib anywhere but windows,
>
>
> pragma(lib) works on all versions of dmd, including on Linux.

No, I meant that phobos only uses pragma(lib) on Windows.

-Steve
April 24, 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

April 25, 2015
On 24 Apr 2015 22:55, "Steven Schveighoffer via Digitalmars-d" < digitalmars-d@puremagic.com> 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
>
> // this will cause an error until you install the binding, then you can
> // go through your imports and update them.
> public import some.dub.project;
>
>
>> As for pragma(lib) - it can never work "normally". Linking 3d-party libraries is very platform-specific task that causes great deal of complexity in build systems. It can't be replaced by a single trivial compiler pragma. There is a reason nothing but Windows build of DMD supports it.
>
>
> 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.
>

Doesn't DMD use dmd.conf for these?  Libc may be called something else, libm may or may not be part of libc, and librt may not exist at all.

For the first two, the system C compiler will know this information and implicitly link when you run 'cc mydprog.o -lphobos2'.  For librt, it's less likely so you'll need '-L-lrt' in your D environment vars.


April 25, 2015
On Friday, 24 April 2015 at 21:47:50 UTC, cym13 wrote:
> Reimplementing sure sounds like the best long-term way to go...
> Maybe we don't need all libcurl features, we could provide a basic
> set for 80% of use-cases and advanced users would use the
> newly-non-standard libcurl binding.

Vibed already provides a good HTTP library. There is also an HTTP/2 library on dub that is being incorporated into Vibed. I would suggesting using these if you are doing anything new rather than using std.net.curl.

April 27, 2015
On 2015-04-24 22:27, Steven Schveighoffer wrote:

> If pragma(lib, "libcurl"); doesn't work normally, then we should remove
> std.net.curl, and put it in dub.

It doesn't work with GDC.

-- 
/Jacob Carlborg
April 27, 2015
On 2015-04-25 08:42, Iain Buclaw via Digitalmars-d wrote:

> Doesn't DMD use dmd.conf for these?

No, on OS X DMD adds the following when calling GCC:

-lphobos2 -lpthread -lm

-- 
/Jacob Carlborg
1 2 3
Next ›   Last »