BaH.libcurl: TCurlMulti [Solved, Compiler issue]

BlitzMax Forums/Brucey's Modules/BaH.libcurl: TCurlMulti [Solved, Compiler issue]

Xaymar(Posted 2013) [#1]
I've been trying to use TCurlMulti to download multiple files and not stall the program, since TCurlEasy.perform() seems to download the entire file and pause the rest of the program.

Problem 1: multiPerform seems to do nothing, no matter how many TCurlEasy are added. The only callback ever called is the progress callback with 0 as parameter. No other information is sent out to stdout, even when enabling verbose. Wireshark reveals that no connection is ever made.

Problem 2: BaH.libcurl seems to cause the executable to stop working on Windows XP with the not-a-valid-win32-binary error. Am I compiling it wrong?

I'm using Windows 7 64bit and the BlitzMax demo.


Grisu(Posted 2013) [#2]
Did you get Brucey's latest module from svn?

@1: Here's some code I'm using for this, it might give you a hint:
http://www.blitzbasic.com/Community/post.php?topic=99640&post=1172294
It works under Win7/8/XP Linux and Mac.


Xaymar(Posted 2013) [#3]
@Grisu:

I took a look at it and the only thing that I noticed was different is that the TCurlMulti instance is created in Load().

Aside from that I noticed that bmk is calling both TDM-GCC64 and TDM-GCC binaries while building libcurl, I removed TDM-GCC64 from %Path% and now it seems to work, except that it still is not a valid win32 binary on Windows XP. (How did it even get to TDM-GCC64? The 32bit binaries were listed first in %Path%...)


Grisu(Posted 2013) [#4]
From an installation mismatch?

Under Windows I use this MinGW distribution: http://nuwen.net/mingw.html


Xaymar(Posted 2013) [#5]
I seem to have isolated the problem to the case where a TCurlMulti instance is used multiple times. As long as I recreate the instance, everything is fine again. Not the best solution, but it will have to do.
Edit: Solved it by building on Windows XP. Unsure what is causing it to be an invalid win32 binary, since both system have an indentical setup.


Brucey(Posted 2013) [#6]
Example 5 in the examples folder shows basic multi usage.

You may see the occasional momentary stall (fractions of a second) on calls to multiPerform(), because of the nature of BlitzMax's single-threadedness. But it generally performs without any noticeable waiting.

You should be able to create a single instance of TCurlMulti and use it throughout the lifetime of an application, creating/removing any number of curl handles.


Presumably, the demo-version of BlitzMax doesn't actually provide the MinGW parts (in bin and lib) for compiling non-BlitzMax code? (that the full version does).


Grisu(Posted 2013) [#7]
Thanks for the libcurl update!