On Tue, 25 Mar 2008, Serge Fukanchik wrote:
> Lee Begg wrote:
> > Hummm..... patch please?
>
> I attached patch which makes it possible to compile libtpproto_cpp
> for Win32 and Pocket PC.
> I used Embedded MSVC 4.0 available for free from Microsoft to compile
> code for Pocket PC.
> I used MinGW to compile code for Win32.
>
> Few notes:
> I replaced long long with int64_t, unsigned long long with uint64_t,
> uint with uint32_t.

Cool. I have also done this and has been pushed to git.

> In Win32 to close socket you call closesocket() instead of close(). I
> added #ifdef _WIN32.
>
> Compiler doesn't recognize LL suffix as 64-bit type. And 0 always have
> type you need. So i just replaced all 0LL's with simple 0.

I notice in other places I have 'll' suffix for 64-bit ints. But that solution 
works fine.

> WinCE platform have no iostream library, so i added #ifdef HAVE_IOSTREAM
> around uses of cout and cerr.

cout and cerr should disappear from the library, but it's still needed for the 
tests.

> There is no stdint.h. I had to add #ifdef HAVE_STDINT_H

Humm... ok, I might have to write an autoconf test for that.

> I replaced pthread mutexes with my siple cross-platform implementation.
>
> WinCE platform has no sstream. I replaced stringstream  with simple
> strring+string. and added #ifdef HAVE_SSTREAM

Fun.

> Added include of "config.h" everywhere. After you replace long long with
> int64_t there are many new places where you need it. Anyway i believe
> it's a bad habit not to include config.h everywhere.

Ok. I think that is reasonable.

> Declaration of variable inside 'for' loop creates it in parent scope.
> So you can not declare same name twice in function:
> for(int i....)
> ....
> for(int i...)
> That is why i had to rename loop variables from i to itcategory and so on.

That is a broken compiler. ISO C++ says that those int i are in the loops 
scope. I will consider fixing for readability reasons though.

> There was some problems with htonq/ntohq, but fortunately it's not used
> in code.

That's odd. htonq/ntonq should be used in Buffer::unpackInt64() and 
Buffer::packInt64(). There is a few macros at the top to use first existing 
functions, then a local implementation.

> For reference purpose i also attached my manually created config.h.

Thanks. I *might* include this file as config.h.in.win32, maybe.

> There are some problems with autoconf script in MinGW, which i'm not
> able to resolve. That is why i had to create makefile and config.h for
> Win32 manually.

Odd. Probably due to not having gnutls. Released versions will not have this 
problem.

> httpssocket, tlssocket, tpssocket aren't used at all.
>
> If you see some problems with patch (probably it makes code
> non-compilable on your platform) just tell me and i will try to fix
> problems and resend you patch.

Cool. 

> ---
> Sergey

Thanks Sergey. I haven't actually looked at the patch yet, but I will when I 
have some time to give it a good look.

Nice screen shots, btw. :-)

BTW, does boost work on WinCE? I was thinking of using it in libtpproto-cpp 
when it gets made more asynchronous.

Later
Lee Begg

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
tp-devel mailing list
[email protected]
http://www.thousandparsec.net/tp/mailman.php/listinfo/tp-devel

Reply via email to