Re: rand48 replacement
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Aleksander Alekseev <aleksander@timescale.com>,
PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2021-09-30T08:23:00Z
Lists: pgsql-hackers
> Attached v15 also does call srandom if it is there, and fixes yet another > remaining random call. I think that I have now removed all references to "random" from pg source. However, the test still fails on windows, because the linker does not find a global variable when compiling extensions, but it seems to find the functions defined in the very same file... Link: 4130 C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64\link.exe /ERRORREPORT:QUEUE /OUT:".\Release\tablefunc\tablefunc.dll" /INCREMENTAL:NO /NOLOGO Release/postgres/postgres.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NODEFAULTLIB:libc /DEF:"./Release/tablefunc/tablefunc.def" /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:".\Release\tablefunc\tablefunc.pdb" /SUBSYSTEM:CONSOLE /STACK:"4194304" /TLBID:1 /DYNAMICBASE:NO /NXCOMPAT /IMPLIB:"Release/tablefunc/tablefunc.lib" /MACHINE:X64 /ignore:4197 /DLL .\Release\tablefunc\win32ver.res 4131 .\Release\tablefunc\tablefunc.obj 4132 Creating library Release/tablefunc/tablefunc.lib and object Release/tablefunc/tablefunc.exp 4133 tablefunc.obj : error LNK2001: unresolved external symbol pg_global_prng_state [C:\projects\postgresql\tablefunc.vcxproj] 4134 .\Release\tablefunc\tablefunc.dll : fatal error LNK1120: 1 unresolved externals [C:\projects\postgresql\tablefunc.vcxproj] 4135 Done Building Project "C:\projects\postgresql\tablefunc.vcxproj" (default targets) -- FAILED. The missing symbol is really defined in common/pg_prng.c which AFAICT is linked with postgres. If someone experienced with the windows compilation chain could give a hint of what is needed, I'd appreciate it! -- Fabien.
Commits
-
Replace random(), pg_erand48(), etc with a better PRNG API and algorithm.
- 3804539e48e7 15.0 landed