Re: WinCE/Pocket PC port for the C client library

Lists: Postg토토 사이트
From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Nuno Lucas" <ntlucas(at)gmail(dot)com>, <pgsql-ports(at)postgresql(dot)org>
Subject: Re: WinCE/Pocket PC port for the C client library
Date: 2006-04-13 09:07:45
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCEA352A4@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

> Hello,
>
> I'm implementing a WinCE 4.x (Pocket PC 2003) application
> which needs to get data from a postgres database, so I
> "hacked" the 8.1.2 libpq source so I could get it working.
>
> Well, it seems to be working ok, but, as I don't know the
> code, have no idea if my hack is acceptable or induces other
> bugs I haven't seen yet.

# add_file "src/include/pg_config.h"
# add_file "src/include/pg_config_paths.h"

This part certainly isn't right :-) Those files are supposed to be
auto-generated, not put in the source.

As for:
- if (getsockopt(conn->sock, SOL_SOCKET,
SO_ERROR,
- (char *)
&optval, &optlen) == -1)
+ int err = getsockopt(conn->sock,
SOL_SOCKET, SO_ERROR,
+
(char *) &optval, &optlen);
+#if defined(_WIN32_WCE)
+ /* This was "googled" from the curl
library source */
+ /* Always returns this error, bug in CE?
*/
+ if ( err == -1 && SOCK_ERRNO ==
WSAENOPROTOOPT )
+ err=0;
+#endif
+ if ( err == -1 )

Does it actually *have* the option and fail to set it, or is the option
just not there? If it doesn't exist, you should just #ifdef out the
tryign to set the option, IMHO.

Apart from that it looks OK to me. There definitly needs to be some
documentation on how to build it, though...

//Magnus


From: "Nuno Lucas" <ntlucas(at)gmail(dot)com>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: pgsql-ports(at)postgresql(dot)org
Subject: Re: WinCE/Pocket PC port for the C client library
Date: 2006-04-13 09:41:27
Message-ID: c4f20e170604130241w58bfc8adua973f88562e43e77@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 사이트

On 4/13/06, Magnus Hagander <mha(at)sollentuna(dot)net> wrote:
> # add_file "src/include/pg_config.h"
> # add_file "src/include/pg_config_paths.h"
>
> This part certainly isn't right :-) Those files are supposed to be
> auto-generated, not put in the source.

Right. It's here just for convenience and because there is no chance
of autogenerating those (no autoconf port that I know of will ever
understand a WinCE target).

Maybe they should be already generated with some other name (e.g.,
pg_config_wince.h) and some readme telling users to rename/move them
to the right place.

> As for:
> - if (getsockopt(conn->sock, SOL_SOCKET,
> SO_ERROR,
> - (char *)
> &optval, &optlen) == -1)
> + int err = getsockopt(conn->sock,
> SOL_SOCKET, SO_ERROR,
> +
> (char *) &optval, &optlen);
> +#if defined(_WIN32_WCE)
> + /* This was "googled" from the curl
> library source */
> + /* Always returns this error, bug in CE?
> */
> + if ( err == -1 && SOCK_ERRNO ==
> WSAENOPROTOOPT )
> + err=0;
> +#endif
> + if ( err == -1 )
>
>
> Does it actually *have* the option and fail to set it, or is the option
> just not there? If it doesn't exist, you should just #ifdef out the
> tryign to set the option, IMHO.

I really have no idea.
It seems it accepts the option, but always returns the error when
checking for it on WinCE.
After I tried googling for it I discovered the curl library port for
WinCE also checks for that error and ignores it (on WinCE).

I was hoping some WinCE sockets "guru" could explain that to me ;-)

A link to some curl library source I found with google is here:
http://cool.haxx.se/cvs.cgi/curl/lib/connect.c?rev=1.120&content-type=text/vnd.viewcvs-markup

Look for the verifyconnect() static function and you'll notice their use.

> Apart from that it looks OK to me. There definitly needs to be some
> documentation on how to build it, though...

Yeah, that's why I included the eVC 4 project files, which include
projects for building it as static library and as a DLL.

For those that know it's way around the eVC compiler it should be easy
enough to see what files need to be included on the project.

As I'm not an english native speaker I was hopping some interested
user would help in the documentation.

Best regards,
~Nuno Lucas

P.S.- I had an old sourceforge project when I ported SQLite for WinCE
(which is now part of the official source) and as the SQLmd is also a
SQLite utility program, I put the source there (instead of in my
bandwidth limited home server).

You can get the source here:
http://sourceforge.net/project/showfiles.php?group_id=88393&package_id=187273&release_id=409524

>
> //Magnus
>