xref: /aoo41x/main/sal/rtl/source/alloc_fini.cxx (revision 79aad27f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 /*
25   Issue http://udk.openoffice.org/issues/show_bug.cgi?id=92388
26 
27   Mac OS X does not seem to support "__cxa__atexit", thus leading
28   to the situation that "__attribute__((destructor))__" functions
29   (in particular "rtl_{memory|cache|arena}_fini") become called
30   _before_ global C++ object d'tors.
31 
32   Using a C++ dummy object instead.
33 */
34 
35 extern "C" void rtl_memory_fini (void);
36 extern "C" void rtl_cache_fini (void);
37 extern "C" void rtl_arena_fini (void);
38 
39 struct RTL_Alloc_Fini
40 {
41   ~RTL_Alloc_Fini() ;
42 };
43 
~RTL_Alloc_Fini()44 RTL_Alloc_Fini::~RTL_Alloc_Fini()
45 {
46   rtl_memory_fini();
47   rtl_cache_fini();
48   rtl_arena_fini();
49 }
50 
51 static RTL_Alloc_Fini g_RTL_Alloc_Fini;
52