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