RejectedSoftware Forums

Sign up

Binary works when compiled with DMD but not Dub

Hi!

I'm pretty new to D and dub but very much enjoying it so far.

However, I have stumbled across a very confusing issue.

Compiling this code directly with dmd works beautifully, and I have no issues running the binary.

import std.stdio;
import std.net.curl;

void main()
{
	auto content = get("https://httpbin.org/get");
	writefln(content);
}

However,
running dub init curltest and putting that code in app.d
and then running dub run or dub build (--compiler dmd) results in :

std.net.curl.CurlException@std/net/curl.d(4364): Couldn't resolve host name on handle 560A092C2850

This makes it seem like dub (somehow) uses its own libaries or maybe needs configuration to allow curl?

If someone could enlighten me and/or point me in the right direction I'd be very grateful.

Re: Binary works when compiled with DMD but not Dub

Quick correction: If I do dub build and then manually run the binary it works fine too.

So, the issue is the dub run command.