ldrNative-posix.cpp revision a4d7fc6f54717c342281099fe14f5666be9b7921
/* $Id$ */
/** @file
* innotek Portable Runtime - Binary Image Loader, POSIX native.
*/
/*
* Copyright (C) 2006-2007 innotek 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))
{
#if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
static const char s_szSuff[] = ".DLL";
#elif defined(RT_OS_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 RT_OS_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;
}