1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "GLLibraryLoader.h"
18 void ClearSymbols(const SymLoadStruct
* const firstStruct
) {
19 for (auto itr
= firstStruct
; itr
->symPointer
; ++itr
) {
20 *itr
->symPointer
= nullptr;
24 bool SymbolLoader::LoadSymbols(const SymLoadStruct
* const firstStruct
,
25 const bool warnOnFailures
) const {
28 for (auto itr
= firstStruct
; itr
->symPointer
; ++itr
) {
29 *itr
->symPointer
= nullptr;
31 for (const auto& s
: itr
->symNames
) {
34 const auto p
= GetProcAddress(s
);
41 if (!*itr
->symPointer
) {
43 printf_stderr("Can't find symbol '%s'.\n", itr
->symNames
[0]);
54 PRFuncPtr
SymbolLoader::GetProcAddress(const char* const name
) const {
56 static const std::regex
kRESymbol("[a-z].*");
57 if (!std::regex_match(name
, kRESymbol
)) {
58 gfxCriticalError() << "Bad symbol name : " << name
;
62 PRFuncPtr ret
= nullptr;
64 ret
= PR_FindFunctionSymbol(mLib
, name
);
73 } // namespace mozilla