1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/libdl/src/libdl.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,90 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Name : libdl.cpp
1.18 +// Part of : libdl library
1.19 +// Dll entry point functions
1.20 +//
1.21 +
1.22 +
1.23 +
1.24 +
1.25 +// INCLUDE FILES
1.26 +#include <dlfcn.h> //RTLD_DEFAULT
1.27 +#include "libdl_r.h" //_r functions
1.28 +
1.29 +
1.30 +
1.31 +// EXTERNAL FUNCTION PROTOTYPES
1.32 +
1.33 +
1.34 +//-----------------------------------------------------------------------------
1.35 +//Function Name : void* dlopen(const char* filename, int flag)
1.36 +//Description : It takes the filename of the dynamic library to be loaded.
1.37 +// The dynamic library is loaded and a "handle" to this executable
1.38 +// is returned to the caller.
1.39 +//Return Value : valid handle if succesful otherwise NULL and an error message
1.40 +// is logged. The user can retrieve the error message through a
1.41 +// call to dlerror()
1.42 +//-----------------------------------------------------------------------------
1.43 +EXPORT_C void* dlopen(const char* filename, int flag)
1.44 + {
1.45 + if ( !filename )
1.46 + {
1.47 + return RTLD_DEFAULT;
1.48 + }
1.49 + return __dlopen_r(filename, flag);;
1.50 + }
1.51 +
1.52 +//-----------------------------------------------------------------------------
1.53 +//Function Name : void* dlsym(void* handle, const char* symbol)
1.54 +//Description : It takes the handle (as returned by dlopen or RTLD_DEFAULT/
1.55 +// RTLD_NEXT/RTLD_SELF) and the NULL terminated string for symbol
1.56 +// name or the ordinal number. It locates the symbol corresponding
1.57 +// to this name or ordinal number.
1.58 +//Return Value : Symbols address address if the symbol name or ordinal number
1.59 +// is found, otherwise NULL is returned and an error message is
1.60 +// logged. The user can retrieve the error message through a call
1.61 +// to dlerror().
1.62 +//-----------------------------------------------------------------------------
1.63 +EXPORT_C void* dlsym(void* handle, const char* symbol)
1.64 + {
1.65 + return __dlsym_r(handle, symbol);
1.66 + }
1.67 +
1.68 +//-----------------------------------------------------------------------------
1.69 +//Function Name : char* dlerror(void)
1.70 +//Description : Gives the last error that occurred due to any of the dl
1.71 +// operations.
1.72 +//Return Value : a NULL-terminated character string that gives the last error
1.73 +// that occurred due to any of the dl operations. If no errors
1.74 +// have occurred since the last call to dlerror(), dlerror()
1.75 +// returns NULL.
1.76 +//-----------------------------------------------------------------------------
1.77 +EXPORT_C char* dlerror(void)
1.78 + {
1.79 + return (char*) __dlerror_r();
1.80 + }
1.81 +
1.82 +
1.83 +//-----------------------------------------------------------------------------
1.84 +//Function Name : int dlclose(void* handle)
1.85 +//Description : Decrements the reference count corresponding to the handle.
1.86 +// If refrence count becomes zero library is unloaded.
1.87 +//Return Value : 0 on success otherwise non zero value
1.88 +//-----------------------------------------------------------------------------
1.89 +EXPORT_C int dlclose(void* handle)
1.90 + {
1.91 + return __dlclose_r(handle);
1.92 + }
1.93 +