2016-11-25 72 views
0

我嘗試從std.net.curlstd.net.curl應用程序將引發異常

import std.net.curl, std.stdio; 

void main() 
{ 
    auto range1 = byLineAsync("www.google.com"); 
    auto range2 = byLineAsync("www.wikipedia.org"); 
    foreach (line; byLineAsync("dlang.org")) 
     writeln(line); 

    foreach (line; range1) writeln(line); 
    foreach (line; range2) writeln(line); 
} 

編譯這個程序我編譯這個程序是這樣的。

$ DMD internet.d -ofinternet

DMD -I/usr/include目錄/ DMD /火衛一-LL:libcurl.so.4.2.0 internet.d -ofinternet

該程序編譯正常,但它會引發異常。

[email protected]/concurrency.d(273): Priority message 
---------------- 
??:? _D3std11concurrency10MessageBox160__T3getTDFS3std11concurrency3TidS3std3net4curl21__T11CurlMessageTAyaZ11CurlMessageZbTDFS3std11concurrency3TidS3std3net4curl19__T11CurlMessageTbZ11CurlMessageZbZ3getMFDFS3std11concurrency3TidS3std3net4curl21__T11CurlMessageTAyaZ11CurlMessageZbDFS3std11concurrency3TidS3std3net4curl19__T11CurlMessageTbZ11CurlMessageZbZ3ptyMFKS3std11concurrency36__T4ListTS3std11concurrency7MessageZ4ListZb [0x81d03f4] 
??:? bool std.concurrency.MessageBox.get!(bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(immutable(char)[]).CurlMessage), bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(bool).CurlMessage)).get(bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(immutable(char)[]).CurlMessage), bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(bool).CurlMessage)) [0x81cfeed] 
??:? void std.concurrency.receive!(bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(immutable(char)[]).CurlMessage), bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(bool).CurlMessage)).receive(bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(immutable(char)[]).CurlMessage), bool delegate(std.concurrency.Tid, std.net.curl.CurlMessage!(bool).CurlMessage)) [0x81cfd08] 
??:? void std.net.curl.AsyncLineInputRange!(char).AsyncLineInputRange.__mixin5.tryEnsureUnits() [0x81ccb87] 
??:? @property bool std.net.curl.AsyncLineInputRange!(char).AsyncLineInputRange.__mixin5.empty() [0x81cc7db] 
??:? _Dmain [0x81b47b8] 
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x81d9292] 
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x81d91dc] 
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x81d924e] 
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x81d91dc] 
??:? _d_run_main [0x81d916e] 
??:? main [0x81d3393] 
??:? __libc_start_main [0x129532] 

我使用DMD v2.072.0

+2

也許你可以嘗試使用dlang-請求 - https://github.com/ikod/dlang-requests – DejanLekic

回答