2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #include "webrtc/modules/audio_device/linux/latebindingsymboltable_linux.h"
17 // TODO(grunell): Either put inside webrtc namespace or use webrtc:: instead.
18 using namespace webrtc;
20 namespace webrtc_adm_linux {
22 inline static const char *GetDllError() {
24 char *err = dlerror();
31 #error Not implemented
35 DllHandle InternalLoadDll(const char dll_name[]) {
37 DllHandle handle = dlopen(dll_name, RTLD_NOW);
39 #error Not implemented
41 if (handle == kInvalidDllHandle) {
42 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, -1,
43 "Can't load %s : %s", dll_name, GetDllError());
48 void InternalUnloadDll(DllHandle handle) {
50 // TODO(pbos): Remove this dlclose() exclusion when leaks and suppressions from
51 // here are gone (or AddressSanitizer can display them properly).
53 // Skip dlclose() on AddressSanitizer as leaks including this module in the
54 // stack trace gets displayed as <unknown module> instead of the actual library
55 // -> it can not be suppressed.
56 // https://code.google.com/p/address-sanitizer/issues/detail?id=89
58 // Skip dlclose() on ThreadSanitizer since it's hitting an assert.
59 // https://code.google.com/p/webrtc/issues/detail?id=3895
60 #if !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER)
61 if (dlclose(handle) != 0) {
62 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, -1,
65 #endif // !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER)
67 #error Not implemented
71 static bool LoadSymbol(DllHandle handle,
72 const char *symbol_name,
75 *symbol = dlsym(handle, symbol_name);
76 char *err = dlerror();
78 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, -1,
79 "Error loading symbol %s : %d", symbol_name, err);
81 } else if (!*symbol) {
82 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, -1,
83 "Symbol %s is NULL", symbol_name);
88 #error Not implemented
92 // This routine MUST assign SOME value for every symbol, even if that value is
93 // NULL, or else some symbols may be left with uninitialized data that the
94 // caller may later interpret as a valid address.
95 bool InternalLoadSymbols(DllHandle handle,
97 const char *const symbol_names[],
100 // Clear any old errors.
103 for (int i = 0; i < num_symbols; ++i) {
104 if (!LoadSymbol(handle, symbol_names[i], &symbols[i])) {
111 } // namespace webrtc_adm_linux