ldrlazy.h revision 948e859a0f72976ea9b302a6b507dfb9409dc7e1
/** @file
* IPRT - Lazy share library linking (2nd try).
*/
/*
* Copyright (C) 2013 Oracle Corporation
*
* 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 (GPL) 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.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___iprt_ldrlazy_h
#define ___iprt_ldrlazy_h
/** @defgroup grp_rt_ldrlazy Lazy shared library linking.
* @ingroup grp_rt
*
*
* @{
*/
/**
* Defines a module for use in lazy resolving.
*
* @param a_Mod The module name (C name).
* @param a_pszFile The file to tell RTLdrLoad to load.
*/
/**
* Defines a module for use in lazy resolving.
*
* @param a_Mod The module name (C name).
* @param a_pszFile The file to tell RTLdrLoad to load.
* @param a_pfnLoadIt Function to call for loading the DLL, replacing
* RTLdrLoad.
*/
{ \
static bool volatile s_fLoaded = false; \
int rc; \
if (!s_fLoaded) \
{ \
s_fLoaded = true; \
if (RT_FAILURE(rc)) \
return false; \
} \
if (hMod == NIL_RTLDRMOD) \
return false; \
return RT_SUCCESS(rc); \
}
/** Function name mangler for preventing collision with system prototypes. */
/**
* Defines a function that should be lazily resolved.
*/
{ \
if (!s_pfn) \
{ \
return a_ErrRet; \
} \
return s_pfn a_ParamNames; \
}
/** @} */
#endif