Search Postgresql Archives

Re: Custom C function - is palloc broken?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux