Implementing libcurl

From Valve Developer Community
Revision as of 17:42, 5 September 2010 by DaFox (talk | contribs) (mmmm saving it)
Jump to navigation Jump to search

What is libcurl?

libcurl is a free and easy-to-use client-side URL transfer library that allows you to transfer files across the internet through various protocols such as HTTP. It is the base of cURL a very popular command line tool for transferring data.

A few examples of the things that you could do by implementing libcurl into your source engine mod would be to set up an in game poll, download game content, upload player data. The possibilities are endless.

The Installation

You will need to download the latest version of cURL. You can do this by visiting the Download page on their website.

Proceed to extract the zip and open your mod folder, and your mods solution in VS.

In your modname\src\ folder create a new folder named libcurl.

Open the curl folder that you just extracted, browse to curl-#.##.#\lib and copy all of the files in there.

Paste them into your new modname\src\libcurl folder.

Back in the your recently extracted curl folder browse to curl-#.##.#\include and copy the curl folder into your modname\src\libcurl folder.

In VS right click your solution, select Add -> Existing Project. Select modname\src\libcurl\libcurl.vcproj.

VS2008 and 2010 only: Run through the conversion wizard.

Open your client projects properties, go to Configuration Properties -> C/C++ -> General, Open "Additional Include Directories" and add the following to the bottom of the list.

..\..\libcurl\curl

Go to Configuration Properties -> C/C++ -> Preprocessor, Open "Preprocessor Definitions" and add the following to the bottom of the list.

 CURL_STATICLIB


Open the properties for your libcurl project.

Now include the modname\src\libcurl\curl include files into your client project.





The curl license

libcurl is licensed under a MIT/X derivative license

COPYRIGHT AND PERMISSION NOTICE

Copyright (c) 1996 - 2010, Daniel Stenberg, <daniel@haxx.se>.

All rights reserved.

Permission to use, copy, modify, and distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright
notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.