1#include <stdlib.h>
2#include <mach-o/ldsyms.h>
3
4__private_extern__
5int _dyld_func_lookup(
6    const char *dyld_func_name,
7    unsigned long *address);
8
9
10#if defined(__ppc__)
11/*
12 * __initialize_Cplusplus() is a symbols specific to each shared library that
13 * can be called in the shared library's initialization routine to force the
14 * C++ runtime to be initialized so it can be used.  Shared library
15 * initialization routines are called before C++ static initializers are called
16 * so if a shared library's initialization routine depends on them it must make
17 * a call to __initialize_Cplusplus() first.
18 *
19 * This function is deprecated in Mac OS X 10.4 because C++ static initializers
20 * are now called in the correct order.  Therefore, no ppc64 program needs this.
21 */
22__private_extern__
23void
24__initialize_Cplusplus(void)
25{
26    void (*p)(const struct mach_header *);
27
28        _dyld_func_lookup("__dyld_call_module_initializers_for_dylib",
29                          (unsigned long *)&p);
30	if(p != NULL)
31	    p(&_mh_dylib_header);
32}
33#endif /* !defined(__ppc64__) */
34