2 * Copyright (c) 2017 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
26 #ifndef __DYLD_PATH_OVERRIDES_H__
27 #define __DYLD_PATH_OVERRIDES_H__
37 #include "MachOParser.h"
42 class VIS_HIDDEN PathOverrides
46 // libdyld is never unloaded
51 void setEnvVars(const char* envp
[]);
52 void forEachPathVariant(const char* initialPath
, void (^handler
)(const char* possiblePath
, bool& stop
)) const;
54 PathOverrides(const std::vector
<std::string
>& env
);
55 void forEachPathVariant(const char* initialPath
, Platform platform
, void (^handler
)(const char* possiblePath
, bool& stop
)) const;
58 uint32_t envVarCount() const;
59 void forEachEnvVar(void (^handler
)(const char* envVar
)) const;
60 void forEachInsertedDylib(void (^handler
)(const char* dylibPath
)) const;
63 void forEachInColonList(const char* list
, void (^callback
)(const char* path
));
64 const char** parseColonListIntoArray(const char* list
);
65 void freeArray(const char** array
);
66 void addEnvVar(const char* keyEqualsValue
);
67 const char* getFrameworkPartialPath(const char* path
) const;
68 static const char* getLibraryLeafName(const char* path
);
69 void handleListEnvVar(const char* key
, const char** list
, void (^handler
)(const char* envVar
)) const;
70 void handleEnvVar(const char* key
, const char* value
, void (^handler
)(const char* envVar
)) const;
71 void forEachDylibFallback(Platform platform
, void (^handler
)(const char* fallbackDir
, bool& stop
)) const;
72 void forEachFrameworkFallback(Platform platform
, void (^handler
)(const char* fallbackDir
, bool& stop
)) const;
74 const char** _dylibPathOverrides
= nullptr;
75 const char** _frameworkPathOverrides
= nullptr;
76 const char** _dylibPathFallbacks
= nullptr;
77 const char** _frameworkPathFallbacks
= nullptr;
78 const char** _insertedDylibs
= nullptr;
79 const char* _imageSuffix
= nullptr;
80 const char* _rootPath
= nullptr; // simulator only
84 extern PathOverrides gPathOverrides
;
90 #endif // __DYLD_PATH_OVERRIDES_H__