www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to include curl.lib?

reply Head Scratcher <filter stumped.com> writes:
The following text is in the source code for curl.d:

Windows x86 note:
A DMD compatible libcurl static library can be downloaded from 
the dlang.org
$(LINK2 http://downloads.dlang.org/other/index.html, download 
archive page).

I downloaded that static library. How do I link it into my D 
project?  Is it something I can put into dub.json?
Jan 14 2019
parent reply Head Scratcher <filter stumped.com> writes:
On Monday, 14 January 2019 at 18:45:27 UTC, Head Scratcher wrote:
 The following text is in the source code for curl.d:

 Windows x86 note:
 A DMD compatible libcurl static library can be downloaded from 
 the dlang.org
 $(LINK2 http://downloads.dlang.org/other/index.html, download 
 archive page).

 I downloaded that static library. How do I link it into my D 
 project?  Is it something I can put into dub.json?
It would be nice to compile my app into one EXE file including std.curl and curl.lib. Does nobody know how to do this?
Jan 17 2019
parent reply Andre Pany <andre s-e-a-p.de> writes:
On Thursday, 17 January 2019 at 20:05:27 UTC, Head Scratcher 
wrote:
 On Monday, 14 January 2019 at 18:45:27 UTC, Head Scratcher 
 wrote:
 The following text is in the source code for curl.d:

 Windows x86 note:
 A DMD compatible libcurl static library can be downloaded from 
 the dlang.org
 $(LINK2 http://downloads.dlang.org/other/index.html, download 
 archive page).

 I downloaded that static library. How do I link it into my D 
 project?  Is it something I can put into dub.json?
It would be nice to compile my app into one EXE file including std.curl and curl.lib. Does nobody know how to do this?
You do not need to specify curl.lib but you have to bundle your executable with curl.dll. Recent Windows 10 versions might even come with curl.dll but I am not 100% sure. Kind regards Andre
Jan 17 2019
parent reply Head Scratcher <filter stumped.com> writes:
On Thursday, 17 January 2019 at 20:42:48 UTC, Andre Pany wrote:

 You do not need to specify curl.lib but you have to bundle your 
 executable with curl.dll.
 Recent Windows 10 versions might even come with curl.dll but I 
 am not 100% sure.
Thank you for your reply, Andre. My computer has curl.exe in the Windows\System32 folder, but I'm not sure I can guarantee that any users of my EXE will have that. I am writing a utility program that performs FTP. According to the std.curl source code, curl.lib can be statically linked. Is that not the case?
Jan 18 2019
parent Andre Pany <andre s-e-a-p.de> writes:
On Friday, 18 January 2019 at 15:49:09 UTC, Head Scratcher wrote:
 On Thursday, 17 January 2019 at 20:42:48 UTC, Andre Pany wrote:

 You do not need to specify curl.lib but you have to bundle 
 your executable with curl.dll.
 Recent Windows 10 versions might even come with curl.dll but I 
 am not 100% sure.
Thank you for your reply, Andre. My computer has curl.exe in the Windows\System32 folder, but I'm not sure I can guarantee that any users of my EXE will have that. I am writing a utility program that performs FTP. According to the std.curl source code, curl.lib can be statically linked. Is that not the case?
I thought also the libcurl.dll is available but it doesn't seems so. The curl executable does not have any use in your case. I am not an expert in this area but I think it should be possible, but I do not how. I can only give you the advice to start with the dll approach. At any point later you can just switch to the static linking approach. Depending on the license type of your application you might also check whether you are allowed to statically bind curl. Kind regards Andre
Jan 18 2019