<i>Tcl_StatBuf definition problem with VS2005 and Win XP x64</i> status still Open with 4 other changes
by
.
D 2009-04-30T16:56:29
J icomment This\sis\sa\sbigger\smess\sthan\sI\sthought.\sUsing\sthe\sfollowing\sprogram\swe\scan\sexplore\sthe\ssize\sof\sthe\sTcl_StatBuf\sstructure\smembers\sfor\sTcl\scompiled\swith\svarious\scompilers:\n#include\s<sys/stat.h>\n#include\s<tcl.h>\nint\smain(void)\s{\n\s\s\s\sTcl_StatBuf\sst;\sst.st_size\s=\s0;\n\s\s\s\sprintf("time_t\s%u\sst_size\s%u\sst_atime\s%u\\n",\n\s\s\s\s\s\s\s\ssizeof(time_t),\ssizeof(st.st_size),\ssizeof(st.st_atime));\n\s\s\s\sreturn\s0;\n}\nUsing\sthis\swith\stcl8.4\sheaders\swe\sget:\nix86\sgcc-3.4.5\stime_t\s4\sst_size\s4\sst_atime\s4\nix86\smsvc-6\s\s\s\stime_t\s4\sst_size\s8\sst_atime\s4\nix86\smsvc-9\s\s\s\stime_t\s8\sst_size\s8\sst_atime\s8\n\namd64\smsvc9\s\s\s\s\stime_t\s8\sst_size\s8\sst_atime\s8\namd64\smsvc8\s\s\s\s\stime_t\s8\sst_size\s8\sst_atime\s8\namd64\sgcc-4.4.0\stime_t\s8\sst_size\s4\sst_atime\s8\s\n\nSo\sit's\spretty\swell\sscrewed\swhichever\sway\syou\sgo.\sThere\sis\sno\schance\sthat\san\sextension\scompiled\swith\sgcc\swill\sbe\sable\sto\suse\sthis\sstructure\sproperly\sin\sa\smsvc\scompiled\stclsh.\n\nWe\scan\sfix\sthis\swith\sthe\smost\shideously\scomplex\slooking\spile\sof\scrap:\n#if\sdefined(__GNUC__)\n#\s\s\s\sif\sdefined(_WIN64)\ntypedef\sstruct\s_stat64\sTcl_StatBuf;\n#\s\s\s\selse\s/*\s!_WIN64\s*/\ntypedef\sstruct\s_stati64\sTcl_StatBuf;\n#\s\s\s\sendif\s/*\s!_WIN64\s*/\n#else\s/*\s!__GNUC__*/\n#\s\s\s\sif\sdefined(__BORLANDC__)\ntypedef\sstruct\sstati64\sTcl_StatBuf;\n#\s\s\s\selse\s/*\s!__BORLANDC__\s*/\n#\s\s\s\s\s\s\s\sif\s_MSC_VER\s<\s1500\ntypedef\sstruct\s_stati64\sTcl_StatBuf;\n#\s\s\s\s\s\s\s\selse\s\s/*\s_MSC_VER\s>=\s1500\s*/\n#\s\s\s\s\s\s\s\s\s\s\s\sif\sdefined(_M_IX86)\n#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sdefine\s_USE_32BIT_TIME_T\ntypedef\sstruct\s_stat32i64\sTcl_StatBuf;\n#\s\s\s\s\s\s\s\s\s\s\s\selse\s/*\s!defined(_M_IX86)\s*/\ntypedef\sstruct\s_stat64\sTcl_StatBuf;\n#\s\s\s\s\s\s\s\s\s\s\s\sendif\s/*\s!defined(_M_IX86)\s*/\n#\s\s\s\s\s\s\s\sendif\s/*\s_MSC_VER\s>=\s1400\s*/\n#\s\s\s\sendif\s/*\s!__BORLANDC__\s*/\n#endif\s/*\s!__GNUC__*/\n\nThis\sproduces\sa\s32bit\stime_t\sand\s64bit\sst_size\smember\sfor\s32\sbit\sWindows\swith\smsvc6\sand\s9\sand\sgcc\s3.\sOn\s64bit\swindows\swe\sget\s64\sbit\stime_t\sand\s64\sbit\sst_size.\s\n\nWith\smsvc9\s(aka\sMSVC\s2008\sor\scl\s1500)\sthe\scompiler\sheaders\sfor\sIX86\sseem\sto\sproduce\sa\s64bit\stime_t\sby\sdefault\sso\sI've\shad\sto\sinclude\sthe\s_USE_32BIT_TIME_T.\sI\sdon't\sunderstand\sthe\suse\sof\sthis\sin\sthe\sMicrosoft\sheaders.\sIn\sthe\snewer\sgcc\sheaders\sthey\sdefine\sthis\smacro\swhen\sthe\starget\ssystem\swill\sbe\sa\s32\sbit\sversion\sof\swindows\swhich\sseems\scorrect.\sIn\sthe\sMSVC\sheaders,\swith\sthis\smacro\sdefined\s_stati64\sbecomes\sdefined\sas\s_stat32i64\swhich\sis\swhat\swe\sneed.\n\nHideous.\n\nGiven\sthat\sthis\sis\sutterly\sbroken\sanyway\sI\ssee\sno\sreason\snot\sto\suse\san\sexplicitly\sdefined\sstructure\swith\sthe\scorrect\sTcl\stypes\sas\smentioned\sis\searlier\sposts.\n
J login patthoyts
J mimetype text/plain
J username patthoyts
K 2651823fffffffffffffffffffffffffffffffff
U patthoyts
Z 068561dd5b177d2152ffea5e3b42101b