curl-library
Windows CE (again)
Date: Sun, 16 Jan 2011 13:54:32 +0000 (GMT)
OK, I have now successfully built a Windows CE executable which uses LIBCURL,
specifically the HTTP file transfer to allow me to send files from my mobile up
to a web site. My development environment is Visual Studio 2005. I built LIBCURL
as a static library which I then linked in with my Windows CE code. Here is a
brief description of the steps I took to create the static library.
1) Dowload LibCurl (I used version 7.21.3) and unpack to a directory.
2) Use VS2005 to open v6curl.dsw - say YES TO ALL to convert to VS2005 format.
3) Create a new solution configuration
- right click on SOLUTION
- select CONFIGURATION MANAGER
- select NEW in the ACTIVE SOLUTION PLATFORM dropdown
- select "Windows Mobile 6 Standard SDK (ARMV4I)"
- press OK
- set the LIBCURL project context to have the "LIB Release" configuration,
for the new platform
- close the configuration manager
4) Right click on the LIBCURL project & select "Project Properties"
Change the options as follows:
- Add the include path to wcecompat
- define the following macros in the PREPROCESSOR section
_DEBUG
_WIN32_WCE=0x502
UNDER_CE
WIN32_PLATFORM_WFSP
WINCE
DEBUG
_WINDOWS
ARM
_ARM_
_UNICODE
UNICODE
SMARTPHONE2003_UI_MODEL
CURL_STATICLIB
WIN32
NDEBUG
BUILDING_LIBCURL
_VC80_UPGRADE=0x0600
_MBCS
HTTP_ONLY
(some of these will already be defined..). They may not all be necessary; but
they work for me.
- At the LIBRARIAN step, specify the Windows CE subssystem. This avoids the
error 'CVTRES : fatal error CVT1109: target machine "THUMB" requires
"/WINDOWSCE"'. This is accessible at the LIBRARIAN..COMMAND LINE options on the
project properties window. Add the line
/SUBSYSTEM:WINDOWSCE
in the ADDITIONAL OPTIONS area.
5) Modify SETUP.H
- If HTTP_ONLY is defined, it defines CURL_DISABLE_LDAP, CURL_DISABLE_TELNET
and CURL_DISABLE_FILE: however,
these three are already defined if we're building for Windows CE. I
modified the HTTP_ONLY define to be
#ifdef HTTP_ONLY
# define CURL_DISABLE_TFTP
# define CURL_DISABLE_FTP
# define CURL_DISABLE_DICT
# define CURL_DISABLE_RTSP
# ifndef WINCE
# define CURL_DISABLE_LDAP
# define CURL_DISABLE_TELNET
# define CURL_DISABLE_FILE
# endif
#endif
6) You'll also need to link in with the WCECOMPAT functions, which I downloaded
from http://wcecompat.sourceforge.net/. I don't remember having any problems
with building this.
HOWEVER --- the STRRCHR function supplied with the WCECOMPAT library has a bug
in it; the pointer isn't decremented, so the code goes into an infinite loop. I
discovered this in function parse_remote_port in file url.c, however the
function is referenced elsewhere in the CURL library. The function is in file
wce211_string.c. I modified this function to read
_CRTIMP char* __cdecl strrchr(const char* s, int c)
{
const char* p = s + strlen(s) - 1;
while (p >= s)
{
if (*p == c)
return (char*)p;
p -= 1;
}
return NULL;
}
(I added the line "p -= 1;").
So far, I've only used this to send files from my mobile to a PHP page, so I
can't vouch for the functionallity of the rest of the library. I have no doubt
that the LIBCURL code will be fine, but there may be other bugs in the WCECOMPAT
code.
I've just heard that we're probably switching development to Android, as
Microsoft seems to be ditching Windows CE, so it's unlikely that we'll be using
LIBCURl. However, once I'd got started I wasn't going to stop until I'd got it
working. Apologies for the delay as I had to break off several times to do other
stuff. If I was going to continue, I'd tidy up all the compiler options so only
those which were strictly necessary remained.
Hope this helps,
Graeme
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-16