mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
Moved dlopen wrappers to loader.c.
This commit is contained in:
parent
a9bedef3f6
commit
bae5c76d0c
@ -405,3 +405,98 @@ void *wine_dll_load_main_exe( const char *name, char *error, int errorsize, int
|
||||
{
|
||||
return dlopen_dll( name, error, errorsize, test_only );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* These functions provide wrappers around dlopen() and associated
|
||||
* functions. They work around a bug in glibc 2.1.x where calling
|
||||
* a dl*() function after a previous dl*() function has failed
|
||||
* without a dlerror() call between the two will cause a crash.
|
||||
* They all take a pointer to a buffer that
|
||||
* will receive the error description (from dlerror()). This
|
||||
* parameter may be NULL if the error description is not required.
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
* wine_dlopen
|
||||
*/
|
||||
void *wine_dlopen( const char *filename, int flag, char *error, int errorsize )
|
||||
{
|
||||
#ifdef HAVE_DLOPEN
|
||||
void *ret;
|
||||
const char *s;
|
||||
dlerror(); dlerror();
|
||||
ret = dlopen( filename, flag );
|
||||
s = dlerror();
|
||||
if (error)
|
||||
{
|
||||
strncpy( error, s ? s : "", errorsize );
|
||||
error[errorsize - 1] = '\0';
|
||||
}
|
||||
dlerror();
|
||||
return ret;
|
||||
#else
|
||||
if (error)
|
||||
{
|
||||
strncpy( error, "dlopen interface not detected by configure", errorsize );
|
||||
error[errorsize - 1] = '\0';
|
||||
}
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wine_dlsym
|
||||
*/
|
||||
void *wine_dlsym( void *handle, const char *symbol, char *error, int errorsize )
|
||||
{
|
||||
#ifdef HAVE_DLOPEN
|
||||
void *ret;
|
||||
const char *s;
|
||||
dlerror(); dlerror();
|
||||
ret = dlsym( handle, symbol );
|
||||
s = dlerror();
|
||||
if (error)
|
||||
{
|
||||
strncpy( error, s ? s : "", errorsize );
|
||||
error[errorsize - 1] = '\0';
|
||||
}
|
||||
dlerror();
|
||||
return ret;
|
||||
#else
|
||||
if (error)
|
||||
{
|
||||
strncpy( error, "dlopen interface not detected by configure", errorsize );
|
||||
error[errorsize - 1] = '\0';
|
||||
}
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wine_dlclose
|
||||
*/
|
||||
int wine_dlclose( void *handle, char *error, int errorsize )
|
||||
{
|
||||
#ifdef HAVE_DLOPEN
|
||||
int ret;
|
||||
const char *s;
|
||||
dlerror(); dlerror();
|
||||
ret = dlclose( handle );
|
||||
s = dlerror();
|
||||
if (error)
|
||||
{
|
||||
strncpy( error, s ? s : "", errorsize );
|
||||
error[errorsize - 1] = '\0';
|
||||
}
|
||||
dlerror();
|
||||
return ret;
|
||||
#else
|
||||
if (error)
|
||||
{
|
||||
strncpy( error, "dlopen interface not detected by configure", errorsize );
|
||||
error[errorsize - 1] = '\0';
|
||||
}
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
@ -248,100 +248,6 @@ void *wine_anon_mmap( void *start, size_t size, int prot, int flags )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* These functions provide wrappers around dlopen() and associated
|
||||
* functions. They work around a bug in glibc 2.1.x where calling
|
||||
* a dl*() function after a previous dl*() function has failed
|
||||
* without a dlerror() call between the two will cause a crash.
|
||||
* They all take a pointer to a buffer that
|
||||
* will receive the error description (from dlerror()). This
|
||||
* parameter may be NULL if the error description is not required.
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
* wine_dlopen
|
||||
*/
|
||||
void *wine_dlopen( const char *filename, int flag, char *error, int errorsize )
|
||||
{
|
||||
#ifdef HAVE_DLOPEN
|
||||
void *ret;
|
||||
const char *s;
|
||||
dlerror(); dlerror();
|
||||
ret = dlopen( filename, flag );
|
||||
s = dlerror();
|
||||
if (error)
|
||||
{
|
||||
strncpy( error, s ? s : "", errorsize );
|
||||
error[errorsize - 1] = '\0';
|
||||
}
|
||||
dlerror();
|
||||
return ret;
|
||||
#else
|
||||
if (error)
|
||||
{
|
||||
strncpy( error, "dlopen interface not detected by configure", errorsize );
|
||||
error[errorsize - 1] = '\0';
|
||||
}
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wine_dlsym
|
||||
*/
|
||||
void *wine_dlsym( void *handle, const char *symbol, char *error, int errorsize )
|
||||
{
|
||||
#ifdef HAVE_DLOPEN
|
||||
void *ret;
|
||||
const char *s;
|
||||
dlerror(); dlerror();
|
||||
ret = dlsym( handle, symbol );
|
||||
s = dlerror();
|
||||
if (error)
|
||||
{
|
||||
strncpy( error, s ? s : "", errorsize );
|
||||
error[errorsize - 1] = '\0';
|
||||
}
|
||||
dlerror();
|
||||
return ret;
|
||||
#else
|
||||
if (error)
|
||||
{
|
||||
strncpy( error, "dlopen interface not detected by configure", errorsize );
|
||||
error[errorsize - 1] = '\0';
|
||||
}
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wine_dlclose
|
||||
*/
|
||||
int wine_dlclose( void *handle, char *error, int errorsize )
|
||||
{
|
||||
#ifdef HAVE_DLOPEN
|
||||
int ret;
|
||||
const char *s;
|
||||
dlerror(); dlerror();
|
||||
ret = dlclose( handle );
|
||||
s = dlerror();
|
||||
if (error)
|
||||
{
|
||||
strncpy( error, s ? s : "", errorsize );
|
||||
error[errorsize - 1] = '\0';
|
||||
}
|
||||
dlerror();
|
||||
return ret;
|
||||
#else
|
||||
if (error)
|
||||
{
|
||||
strncpy( error, "dlopen interface not detected by configure", errorsize );
|
||||
error[errorsize - 1] = '\0';
|
||||
}
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef HAVE_ECVT
|
||||
/***********************************************************************
|
||||
* ecvt
|
||||
|
Loading…
Reference in New Issue
Block a user