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"
9 #include "mozilla/gfx/Logging.h"
19 void ClearSymbols(const SymLoadStruct
* const firstStruct
) {
20 for (auto itr
= firstStruct
; itr
->symPointer
; ++itr
) {
21 *itr
->symPointer
= nullptr;
25 bool SymbolLoader::LoadSymbols(const SymLoadStruct
* const firstStruct
,
26 const bool warnOnFailures
) const {
29 for (auto itr
= firstStruct
; itr
->symPointer
; ++itr
) {
30 *itr
->symPointer
= nullptr;
32 for (const auto& s
: itr
->symNames
) {
35 const auto p
= GetProcAddress(s
);
42 if (!*itr
->symPointer
) {
44 printf_stderr("Can't find symbol '%s'.\n", itr
->symNames
[0]);
55 PRFuncPtr
SymbolLoader::GetProcAddress(const char* const name
) const {
57 static const std::regex
kRESymbol("[a-z].*");
58 if (!std::regex_match(name
, kRESymbol
)) {
59 gfxCriticalError() << "Bad symbol name : " << name
;
63 PRFuncPtr ret
= nullptr;
65 ret
= PR_FindFunctionSymbol(mLib
, name
);
74 } // namespace mozilla