Re: Custom C function - is palloc broken?

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: Custom C function - is palloc broken?
Дата
Msg-id 481FC034.4020907@postnewspapers.com.au
обсуждение исходный текст
Ответ на Re: Custom C function - is palloc broken?  ("Dan \"Heron\" Myers" <heron@xnapid.com>)
Ответы Re: Custom C function - is palloc broken?
Re: Custom C function - is palloc broken?
Список pgsql-general
Dan "Heron" Myers wrote:
> Craig Ringer wrote:
>> I'm actually using a dummy header (just an empty file) for libintl.h .
>> None of the involved module code actually uses anything from libintl,
>> neither directly nor via any inlines/macros from postgresql's headers.
>> I'm not even sure PostgreSQL needs to include the header in its own
>> headers at all; it might be fine being included by the .c files. This
>> shouldn't make any difference.
>
> There are other files (such as netdb.h) which are also missing.  Do I
> also need blank placeholder files for those to compile with VC++?

Sorry, I forgot to mention those because I was lazy and just commented
them out in the Pg headers instead of doing the right thing and
providing a dummy include file. You do appear to need a dummy include,
unless I'm doing something wrong in my build setup. I don't see any
conditional inclusion of these headers, not any existing dummy headers
in the port/ directory, and there aren't any alternative copies of
`port.h' for use on win32, so I don't see how I could be doing it wrong.

Neither netdb.h nor pwd.h seem to actually be used (beyond being
included) on win32, at least with VC++

The other thing I had to do was add include guards on pg_config_os.h to
protect against repeat inclusion. VC++ 8.0 does not like the repeated
definition of `struct timezone' and `struct itimerval' (but 9.0 -
correctly - doesn't care). I have no idea how the standard binaries were
built with VC++ without that change - maybe there's a setting to
convince it to ignore the "problem" that's used in the project
file/makefile.

> It
> seems odd that they can compile PostgreSQL with Visual Studio (according
> to Magnus, anyway) without several of the unix headers it depends on...
>  and if they do, why don't they have some #ifdefs to check whether it's
> building for windows and not include them if it is?

It's entirely possible it was built with dummies for these headers,
perhaps from another project or provided by a win32 port of another
project. I don't know how the build environment for the official win32
binaries is set up.

It's more likely that I'm doing something stupid, but I don't at present
see what it's likely to be.

>> - Does it crash with the same error message & error code?
>
> I don't get an error message per se...  The log file shows no errors,
> but the query window I'm using (in pgadmin) loses its connection and
> Visual Studio's just-in-time debugger pops up asking if I want to debug
> postgres.exe... but if I say yes, it says it can't attach to the
> process.  The crash is the same every time.

And in the server log files (PG_INSTALL_DIR\data\pg_log) ?

>> - Are you testing with the source file I sent (that I know works) or
>> with modified sources based on your original example?
>
> I've tested both your file and mine, compiled with MinGW; both crash
> every time I try any function.

OK, so there are still issues at least with MinGW. I won't venture any
guesses as to what could be going on there; I can only suggest trying
with VC++ . I've done a test build with VC++ 9.0 (Express edition 2008)
as well and encountered no issues, however I would personally stick to
VC++ 8.0 for production use until the Pg binaries are built with 9.0 .

You're asking for trouble by mixing compilers, compiler versions, and
runtimes - even if it appears to work (which it does for VC 9, and not
for MinGW).

I'll see if I can find time to look into the mingw issues anyway, though
I don't know if I'm really up to the task of tracking those problems down.

I'd be interested in confirmation that you're able to get your code
working when you build it with VC++ .

--
Craig Ringer

В списке pgsql-general по дате отправления:

Предыдущее
От: "Dan \"Heron\" Myers"
Дата:
Сообщение: Re: Custom C function - is palloc broken?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Custom C function - is palloc broken?