SharedLibrary.h (1205B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 /* Path charset agnostic wrappers for prlink.h. */ 8 9 #ifndef mozilla_SharedLibrary_h 10 #define mozilla_SharedLibrary_h 11 12 #ifdef MOZILLA_INTERNAL_API 13 14 # include "prlink.h" 15 # include "mozilla/Char16.h" 16 17 namespace mozilla { 18 19 // 20 // Load the specified library. 21 // 22 // @param aPath path to the library 23 // @param aFlags takes PR_LD_* flags (see prlink.h) 24 // 25 inline PRLibrary* 26 # ifdef XP_WIN 27 LoadLibraryWithFlags(char16ptr_t aPath, PRUint32 aFlags = 0) 28 # else 29 LoadLibraryWithFlags(const char* aPath, PRUint32 aFlags = 0) 30 # endif 31 { 32 PRLibSpec libSpec; 33 # ifdef XP_WIN 34 libSpec.type = PR_LibSpec_PathnameU; 35 libSpec.value.pathname_u = aPath; 36 # else 37 libSpec.type = PR_LibSpec_Pathname; 38 libSpec.value.pathname = aPath; 39 # endif 40 return PR_LoadLibraryWithFlags(libSpec, aFlags); 41 } 42 43 } /* namespace mozilla */ 44 45 #endif /* MOZILLA_INTERNAL_API */ 46 47 #endif /* mozilla_SharedLibrary_h */