ldrNative-posix.cpp revision df1dacc373bdd8a15c6abfa6748a67e3454bb9b2
/* $Id$ */
/** @file
* InnoTek Portable Runtime - Binary Image Loader, POSIX native.
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP RTLOGGROUP_LDR
#include <dlfcn.h>
{
/*
* Do we need to add an extension?
*/
if (!RTPathHaveExt(pszFilename))
{
static const char s_szSuff[] = ".DLL";
#elif defined(__DARWIN__)
static const char s_szSuff[] = ".dylib";
#else
static const char s_szSuff[] = ".so";
#endif
if (!psz)
return VERR_NO_MEMORY;
pszFilename = psz;
}
/*
* Attempt load.
*/
if (pvMod)
{
return VINF_SUCCESS;
}
return VERR_FILE_NOT_FOUND;
}
DECLCALLBACK(int) rtldrNativeGetSymbol(PRTLDRMODINTERNAL pMod, const char *pszSymbol, void **ppvValue)
{
#ifdef __OS2__
/* Prefix the symbol with an underscore (assuming __cdecl/gcc-default). */
psz[0] = '_';
#endif
if (*ppvValue)
return VINF_SUCCESS;
return VERR_SYMBOL_NOT_FOUND;
}
{
{
return VINF_SUCCESS;
}
return VERR_GENERAL_FAILURE;
}