<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’m working on integrating PROJ into my Windows application, and I have a problem with uninitialzed static variables in the PROJ lib.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>So far I have been able to build the PROJ lib using the supplied CMAKE scripts. I have successfully linked the lib to my application, and I have been able to call library functions. proj_context_create connects to the sqlite database correctly etc. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>However, the static objects in the PROJ library are never initialized – constructors are never called, so eventually the library crashes in a call to UnitOfMeasure::conversionToSI, because UnitOfMeasure::DEGREE is not initialized.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I have successfully run the library test suite, and I can see that when running the test programs in the debugger, the library static constructors get correctly called from the run-time library’s _initterm function (through a list of function pointers, which I assume the linker sets up). <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>When running my own application, the _initterm function is also correctly called, but it never calls the PROJ static constructors. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I use Visual Studio 2019, and I have carefully checked and compared compiler and linker options between the test suite and my application and have not found anything that can explain this.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I wonder if any of the people who have contributed the test suite may have any ideas as to why this happens?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks in advance for any help.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Finn Arildsen<o:p></o:p></p><p class=MsoNormal>Denmark<o:p></o:p></p></div></body></html>