<div dir="ltr"><div>Hello all:</div><div> </div><div>I am helping to debug a Mach-o dylib program written by C++ and there are some codes like this:</div><div> </div><div>class Resource ; // global static variable </div><div>
 </div><div>__attribute__((destructor))</div><div>void shutdown()</div><div>{</div><div>    Resource->Check();</div><div>}</div><div> </div><div>When dylib unloaded, the static variable Resource will be unloaded first then clang will call shutdown() with a crash.   I tried GCC style __attribute__((destructor(100))) to set the priority but it seems that clang cannot recongnised this.   </div>
<div> </div><div>Is there anyway I can precisely constrol the order of static variables deconstruction and attributed destructor functions in clang.  My environment is Mac OS X 10.7.5, Xcode 4.6 with clang-425.0.24 x86_64-aple-darwin11.4.2</div>
<div> </div><div>Many thanks.</div><div> </div><div>Huaxia </div></div>