sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Name : libdl.cpp sl@0: // Part of : libdl library sl@0: // Dll entry point functions sl@0: // sl@0: sl@0: sl@0: sl@0: sl@0: // INCLUDE FILES sl@0: #include //RTLD_DEFAULT sl@0: #include "libdl_r.h" //_r functions sl@0: sl@0: sl@0: sl@0: // EXTERNAL FUNCTION PROTOTYPES sl@0: sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: //Function Name : void* dlopen(const char* filename, int flag) sl@0: //Description : It takes the filename of the dynamic library to be loaded. sl@0: // The dynamic library is loaded and a "handle" to this executable sl@0: // is returned to the caller. sl@0: //Return Value : valid handle if succesful otherwise NULL and an error message sl@0: // is logged. The user can retrieve the error message through a sl@0: // call to dlerror() sl@0: //----------------------------------------------------------------------------- sl@0: EXPORT_C void* dlopen(const char* filename, int flag) sl@0: { sl@0: if ( !filename ) sl@0: { sl@0: return RTLD_DEFAULT; sl@0: } sl@0: return __dlopen_r(filename, flag);; sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: //Function Name : void* dlsym(void* handle, const char* symbol) sl@0: //Description : It takes the handle (as returned by dlopen or RTLD_DEFAULT/ sl@0: // RTLD_NEXT/RTLD_SELF) and the NULL terminated string for symbol sl@0: // name or the ordinal number. It locates the symbol corresponding sl@0: // to this name or ordinal number. sl@0: //Return Value : Symbols address address if the symbol name or ordinal number sl@0: // is found, otherwise NULL is returned and an error message is sl@0: // logged. The user can retrieve the error message through a call sl@0: // to dlerror(). sl@0: //----------------------------------------------------------------------------- sl@0: EXPORT_C void* dlsym(void* handle, const char* symbol) sl@0: { sl@0: return __dlsym_r(handle, symbol); sl@0: } sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: //Function Name : char* dlerror(void) sl@0: //Description : Gives the last error that occurred due to any of the dl sl@0: // operations. sl@0: //Return Value : a NULL-terminated character string that gives the last error sl@0: // that occurred due to any of the dl operations. If no errors sl@0: // have occurred since the last call to dlerror(), dlerror() sl@0: // returns NULL. sl@0: //----------------------------------------------------------------------------- sl@0: EXPORT_C char* dlerror(void) sl@0: { sl@0: return (char*) __dlerror_r(); sl@0: } sl@0: sl@0: sl@0: //----------------------------------------------------------------------------- sl@0: //Function Name : int dlclose(void* handle) sl@0: //Description : Decrements the reference count corresponding to the handle. sl@0: // If refrence count becomes zero library is unloaded. sl@0: //Return Value : 0 on success otherwise non zero value sl@0: //----------------------------------------------------------------------------- sl@0: EXPORT_C int dlclose(void* handle) sl@0: { sl@0: return __dlclose_r(handle); sl@0: } sl@0: