Re: Problem with ControlFileData structure being ABI dependent - Mailing list pgsql-hackers

From Dave Page
Subject Re: Problem with ControlFileData structure being ABI dependent
Date
Msg-id 47592E27.7000802@postgresql.org
Whole thread Raw
In response to Re: Problem with ControlFileData structure being ABI dependent  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Problem with ControlFileData structure being ABI dependent  (Dave Page <dpage@postgresql.org>)
Re: Problem with ControlFileData structure being ABI dependent  ("Trevor Talbot" <quension@gmail.com>)
List pgsql-hackers
Tom Lane wrote:
> AFAIK, time_t is a Unix-ism, so it's pretty unlikely to be used in the
> APIs of anything on Windows.

Oh, it is.

> I guess my advice would be to see if we can define _USE_32BIT_TIME_T
> in port/win32.h and make it go away that way.  It'd definitely be nice
> if MSVC and Mingw builds weren't binary-incompatible.

The attached patch defines it in the MSVC project files along with the
other API-config related macros. It fixes all the offsets so they match
mingw, but the CRC is still different for some as-yet unknown reason...

VC++ with patch:

WARNING:  sizeof(ControlFileData)=392
WARNING:  offsetof(state)=16
WARNING:  offsetof(time)=20
WARNING:  offsetof(checkPoint)=24
WARNING:  offsetof(prevCheckPoint)=32
WARNING:  offsetof(checkPointCopy)=40
WARNING:  offsetof(minRecoveryPoint)=76
WARNING:  offsetof(maxAlign)=84
WARNING:  offsetof(floatFormat)=88
WARNING:  offsetof(blcksz)=96
WARNING:  offsetof(relseg)=100
WARNING:  offsetof(xlog)=104
WARNING:  offsetof(xlog)=108
WARNING:  offsetof(nameDataLen)=112
WARNING:  offsetof(indexMaxKeys)=116
WARNING:  offsetof(toast)=120
WARNING:  offsetof(enableIntTimes)=124
WARNING:  offsetof(localeBuflen)=128
WARNING:  offsetof(lc)=132
WARNING:  offsetof(lc)=260
WARNING:  offsetof(crc)=388
WARNING:  crc = 2265484434

Mingw:

WARNING:  sizeof(ControlFileData)=392
WARNING:  offsetof(state)=16
WARNING:  offsetof(time)=20
WARNING:  offsetof(checkPoint)=24
WARNING:  offsetof(prevCheckPoint)=32
WARNING:  offsetof(checkPointCopy)=40
WARNING:  offsetof(minRecoveryPoint)=76
WARNING:  offsetof(maxAlign)=84
WARNING:  offsetof(floatFormat)=88
WARNING:  offsetof(blcksz)=96
WARNING:  offsetof(relseg)=100
WARNING:  offsetof(xlog)=104
WARNING:  offsetof(xlog)=108
WARNING:  offsetof(nameDataLen)=112
WARNING:  offsetof(indexMaxKeys)=116
WARNING:  offsetof(toast)=120
WARNING:  offsetof(enableIntTimes)=124
WARNING:  offsetof(localeBuflen)=128
WARNING:  offsetof(lc)=132
WARNING:  offsetof(lc)=260
WARNING:  offsetof(crc)=388
WARNING:  crc = 3643130025

/D
Index: src/tools/msvc/Project.pm
===================================================================
RCS file: /projects/cvsroot/pgsql/src/tools/msvc/Project.pm,v
retrieving revision 1.14
diff -u -r1.14 src/tools/msvc/Project.pm
--- Project.pm    21 Aug 2007 15:10:41 -0000    1.14
+++ Project.pm    7 Dec 2007 11:14:29 -0000
@@ -489,7 +489,7 @@
     ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"
WholeProgramOptimization="$p->{wholeopt}">
     <Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"

AdditionalIncludeDirectories="$self->{prefixincludes}src/include;src/include/port/win32;src/include/port/win32_msvc;$self->{includes}"
-
PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
+
PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T$self->{defines}$p->{defs}"
         StringPooling="$p->{strpool}"
         RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Uniform policy for author credits in contrib module documentation?
Next
From: Dave Page
Date:
Subject: Re: Problem with ControlFileData structure being ABI dependent