@@ -114,13 +114,31 @@ int lookupSymbol(const void *address, SymbolInfo *info);
114
114
// / \param body A function to invoke. This function attempts to first initialize
115
115
// / the Debug Help library. The result of that operation is passed to this
116
116
// / function.
117
+ // / \param context A caller-supplied value to pass to \a body.
117
118
// /
118
119
// / On Windows, the Debug Help library (DbgHelp.lib) is not thread-safe. All
119
120
// / calls into it from the Swift runtime and stdlib should route through this
120
121
// / function.
121
122
SWIFT_RUNTIME_STDLIB_SPI
122
123
void _swift_withWin32DbgHelpLibrary (
123
- const std::function<void (bool /* isInitialized*/ )>& body);
124
+ void (* body)(bool isInitialized, void *context), void *context);
125
+
126
+ // / Configure the environment to allow calling into the Debug Help library.
127
+ // /
128
+ // / \param body A function to invoke. This function attempts to first initialize
129
+ // / the Debug Help library. The result of that operation is passed to this
130
+ // / function.
131
+ // /
132
+ // / On Windows, the Debug Help library (DbgHelp.lib) is not thread-safe. All
133
+ // / calls into it from the Swift runtime and stdlib should route through this
134
+ // / function.
135
+ static inline void _swift_withWin32DbgHelpLibrary (
136
+ const std::function<void (bool /* isInitialized*/ )> &body) {
137
+ _swift_withWin32DbgHelpLibrary ([](bool isInitialized, void *context) {
138
+ auto bodyp = reinterpret_cast <std::function<void (bool )> *>(context);
139
+ (* bodyp)(isInitialized);
140
+ }, const_cast <void *>(reinterpret_cast <const void *>(&body)));
141
+ }
124
142
125
143
// / Configure the environment to allow calling into the Debug Help library.
126
144
// /
0 commit comments