forked from enlightenment/efl
evil: Rename EAPI macro to EVIL_API in Evil library
Summary: Patch from a series of patches to rename EAPI symbols to specific library DSOs. EAPI was designed to be able to pass ```__attribute__ ((visibility ("default")))``` for symbols with GCC, which would mean that even if -fvisibility=hidden was used when compiling the library, the needed symbols would get exported. MSVC __almost__ works like GCC (or mingw) in which you can declare everything as export and it will just work (slower, but it will work). But there's a caveat: global variables will not work the same way for MSVC, but works for mingw and GCC. For global variables (as opposed to functions), MSVC requires correct DSO visibility for MSVC: instead of declaring a symbol as export for everything, you need to declare it as import when importing from another DSO and export when defining it locally. With current EAPI definitions, we get the following example working in mingw and MSVC (observe it doesn't define any global variables as exported symbols). ``` Example 1: dll1: ``` EAPI void foo(void); EAPI void bar() { foo(); } ``` dll2: ``` EAPI void foo() { printf ("foo\n"); } ``` This works fine with API defined as __declspec(dllexport) in both cases and for gcc defining as ```__atttribute__((visibility("default")))``` However, the following: Example 2: dll1: ``` EAPI extern int foo; EAPI void foobar(void); EAPI void bar() { foo = 5; foobar(); } ``` dll2: ``` EAPI int foo = 0; EAPI void foobar() { printf ("foo %d\n", foo); } ``` This will work on mingw but will not work for MSVC. And that's why EAPI is the only solution that worked for MSVC. Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com> Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev> Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com> Reviewers: raster, vtorri, jptiz, lucas, woohyun Reviewed By: vtorri, jptiz Subscribers: ProhtMeyhet, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12182
This commit is contained in:
parent
e9ee9cc3a0
commit
4cee5b05c9
|
@ -39,7 +39,7 @@ _dl_get_last_error(char *desc)
|
||||||
_dl_err_viewed = 0;
|
_dl_err_viewed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
EVIL_API void *
|
||||||
dlopen(const char* path, int mode EVIL_UNUSED)
|
dlopen(const char* path, int mode EVIL_UNUSED)
|
||||||
{
|
{
|
||||||
HMODULE module = NULL;
|
HMODULE module = NULL;
|
||||||
|
@ -95,7 +95,7 @@ dlopen(const char* path, int mode EVIL_UNUSED)
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
EVIL_API int
|
||||||
dlclose(void* handle)
|
dlclose(void* handle)
|
||||||
{
|
{
|
||||||
if (FreeLibrary(handle))
|
if (FreeLibrary(handle))
|
||||||
|
@ -107,7 +107,7 @@ dlclose(void* handle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
EVIL_API void *
|
||||||
dlsym(void *handle, const char *symbol)
|
dlsym(void *handle, const char *symbol)
|
||||||
{
|
{
|
||||||
FARPROC fp = NULL;
|
FARPROC fp = NULL;
|
||||||
|
@ -157,7 +157,7 @@ dlsym(void *handle, const char *symbol)
|
||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
EVIL_API char *
|
||||||
dlerror (void)
|
dlerror (void)
|
||||||
{
|
{
|
||||||
if (!_dl_err_viewed)
|
if (!_dl_err_viewed)
|
||||||
|
@ -184,7 +184,7 @@ _dladdr_comp(const void *p1, const void *p2)
|
||||||
return ( *(int *)p1 - *(int *)p2);
|
return ( *(int *)p1 - *(int *)p2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
EVIL_API int
|
||||||
dladdr (const void *addr, Dl_info *info)
|
dladdr (const void *addr, Dl_info *info)
|
||||||
{
|
{
|
||||||
TCHAR tpath[PATH_MAX];
|
TCHAR tpath[PATH_MAX];
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define __EVIL_DLFCN_H__
|
#define __EVIL_DLFCN_H__
|
||||||
|
|
||||||
|
|
||||||
|
#include "evil_private.h"
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,7 +143,7 @@ struct Dl_info
|
||||||
*
|
*
|
||||||
* @ingroup Evil_Dlfcn
|
* @ingroup Evil_Dlfcn
|
||||||
*/
|
*/
|
||||||
EAPI void *dlopen(const char* path, int mode);
|
EVIL_API void *dlopen(const char* path, int mode);
|
||||||
#ifndef HAVE_DLOPEN
|
#ifndef HAVE_DLOPEN
|
||||||
# define HAVE_DLOPEN 1
|
# define HAVE_DLOPEN 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -168,7 +169,7 @@ EAPI void *dlopen(const char* path, int mode);
|
||||||
*
|
*
|
||||||
* @ingroup Evil_Dlfcn
|
* @ingroup Evil_Dlfcn
|
||||||
*/
|
*/
|
||||||
EAPI int dlclose(void* handle);
|
EVIL_API int dlclose(void* handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the address of a symbol.
|
* @brief Get the address of a symbol.
|
||||||
|
@ -192,7 +193,7 @@ EAPI int dlclose(void* handle);
|
||||||
*
|
*
|
||||||
* @ingroup Evil_Dlfcn
|
* @ingroup Evil_Dlfcn
|
||||||
*/
|
*/
|
||||||
EAPI void *dlsym(void* handle, const char* symbol);
|
EVIL_API void *dlsym(void* handle, const char* symbol);
|
||||||
#ifndef HAVE_DLSYM
|
#ifndef HAVE_DLSYM
|
||||||
# define HAVE_DLSYM 1
|
# define HAVE_DLSYM 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -221,7 +222,7 @@ EAPI void *dlsym(void* handle, const char* symbol);
|
||||||
*
|
*
|
||||||
* @ingroup Evil_Dlfcn
|
* @ingroup Evil_Dlfcn
|
||||||
*/
|
*/
|
||||||
EAPI int dladdr (const void *addr, Dl_info *info);
|
EVIL_API int dladdr(const void *addr, Dl_info *info);
|
||||||
#ifndef HAVE_DLADDR
|
#ifndef HAVE_DLADDR
|
||||||
# define HAVE_DLADDR 1
|
# define HAVE_DLADDR 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -248,7 +249,7 @@ EAPI int dladdr (const void *addr, Dl_info *info);
|
||||||
*
|
*
|
||||||
* @ingroup Evil_Dlfcn
|
* @ingroup Evil_Dlfcn
|
||||||
*/
|
*/
|
||||||
EAPI char *dlerror (void);
|
EVIL_API char *dlerror(void);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __EVIL_DLFCN_H__ */
|
#endif /* __EVIL_DLFCN_H__ */
|
||||||
|
|
|
@ -31,7 +31,8 @@ _is_socket(SOCKET s)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int fcntl(int fd, int cmd, ...)
|
EVIL_API int
|
||||||
|
fcntl(int fd, int cmd, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
|
@ -105,7 +105,7 @@ struct flock
|
||||||
*
|
*
|
||||||
* @ingroup Evil
|
* @ingroup Evil
|
||||||
*/
|
*/
|
||||||
EAPI int fcntl(int fd, int cmd, ...);
|
EVIL_API int fcntl(int fd, int cmd, ...);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __EVIL_FCNTL_H__ */
|
#endif /* __EVIL_FCNTL_H__ */
|
||||||
|
|
|
@ -19,7 +19,7 @@ replace(char *prev, char *value)
|
||||||
return strdup (value);
|
return strdup (value);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
EVIL_API char *
|
||||||
nl_langinfo(nl_item index)
|
nl_langinfo(nl_item index)
|
||||||
{
|
{
|
||||||
static char *result = NULL;
|
static char *result = NULL;
|
||||||
|
|
|
@ -39,7 +39,7 @@ enum {
|
||||||
# define CODESET _NL_CTYPE_CODESET
|
# define CODESET _NL_CTYPE_CODESET
|
||||||
# define RADIXCHAR _NL_NUMERIC_RADIXCHAR
|
# define RADIXCHAR _NL_NUMERIC_RADIXCHAR
|
||||||
|
|
||||||
EAPI char *nl_langinfo(nl_item index);
|
EVIL_API char *nl_langinfo(nl_item index);
|
||||||
|
|
||||||
|
|
||||||
#endif /*__EVIL_LANGINFO_H__ */
|
#endif /*__EVIL_LANGINFO_H__ */
|
||||||
|
|
|
@ -12,21 +12,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
#ifdef EAPI
|
#include "evil_private.h" /* LC_MESSAGES */
|
||||||
# undef EAPI
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef EFL_BUILD
|
|
||||||
# ifdef DLL_EXPORT
|
|
||||||
# define EAPI __declspec(dllexport)
|
|
||||||
# else
|
|
||||||
# define EAPI
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define EAPI __declspec(dllimport)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "evil_locale.h" /* LC_MESSAGES */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME need at least a buffer
|
* LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME need at least a buffer
|
||||||
|
@ -37,7 +23,8 @@ static char _evil_locale_buf[18];
|
||||||
|
|
||||||
#undef setlocale
|
#undef setlocale
|
||||||
|
|
||||||
char *evil_setlocale(int category, const char *locale)
|
EVIL_API char *
|
||||||
|
evil_setlocale(int category, const char *locale)
|
||||||
{
|
{
|
||||||
char buf[9];
|
char buf[9];
|
||||||
int l1;
|
int l1;
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
*
|
*
|
||||||
* @since 1.16
|
* @since 1.16
|
||||||
*/
|
*/
|
||||||
EAPI char *evil_setlocale(int category, const char *locale);
|
EVIL_API char *evil_setlocale(int category, const char *locale);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
* When Evil is not used anymore, call evil_shutdown() to shut down
|
* When Evil is not used anymore, call evil_shutdown() to shut down
|
||||||
* the Evil library.
|
* the Evil library.
|
||||||
*/
|
*/
|
||||||
EAPI int evil_init(void);
|
EVIL_API int evil_init(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Shut down the Evil library.
|
* @brief Shut down the Evil library.
|
||||||
|
@ -115,7 +115,7 @@ EAPI int evil_init(void);
|
||||||
* documentation anymore . You must call evil_init() again to use these
|
* documentation anymore . You must call evil_init() again to use these
|
||||||
* functions again.
|
* functions again.
|
||||||
*/
|
*/
|
||||||
EAPI int evil_shutdown(void);
|
EVIL_API int evil_shutdown(void);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,7 +45,7 @@ _evil_mmap_protection_get(int prot)
|
||||||
/***** API *****/
|
/***** API *****/
|
||||||
|
|
||||||
|
|
||||||
void *
|
EVIL_API void *
|
||||||
mmap(void *addr EVIL_UNUSED,
|
mmap(void *addr EVIL_UNUSED,
|
||||||
size_t len,
|
size_t len,
|
||||||
int prot,
|
int prot,
|
||||||
|
@ -133,7 +133,7 @@ mmap(void *addr EVIL_UNUSED,
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
EVIL_API int
|
||||||
munmap(void *addr,
|
munmap(void *addr,
|
||||||
size_t len EVIL_UNUSED)
|
size_t len EVIL_UNUSED)
|
||||||
{
|
{
|
||||||
|
@ -147,7 +147,7 @@ munmap(void *addr,
|
||||||
return (res == 0) ? -1 : 0;
|
return (res == 0) ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
EVIL_API int
|
||||||
mprotect(void *addr, size_t len, int prot)
|
mprotect(void *addr, size_t len, int prot)
|
||||||
{
|
{
|
||||||
DWORD old;
|
DWORD old;
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
*
|
*
|
||||||
* @ingroup Evil_Mman
|
* @ingroup Evil_Mman
|
||||||
*/
|
*/
|
||||||
EAPI void *mmap(void *addr,
|
EVIL_API void *mmap(void *addr,
|
||||||
size_t len,
|
size_t len,
|
||||||
int prot,
|
int prot,
|
||||||
int flags,
|
int flags,
|
||||||
|
@ -138,7 +138,7 @@ EAPI void *mmap(void *addr,
|
||||||
*
|
*
|
||||||
* @ingroup Evil_Mman
|
* @ingroup Evil_Mman
|
||||||
*/
|
*/
|
||||||
EAPI int munmap(void *addr,
|
EVIL_API int munmap(void *addr,
|
||||||
size_t len);
|
size_t len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,7 +159,7 @@ EAPI int munmap(void *addr,
|
||||||
*
|
*
|
||||||
* @ingroup Evil_Mman
|
* @ingroup Evil_Mman
|
||||||
*/
|
*/
|
||||||
EAPI int mprotect(void *addr, size_t len, int prot);
|
EVIL_API int mprotect(void *addr, size_t len, int prot);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __EVIL_SYS_MMAN_H__ */
|
#endif /* __EVIL_SYS_MMAN_H__ */
|
||||||
|
|
|
@ -26,18 +26,42 @@ extern "C" {
|
||||||
#include <sys/stat.h> /* for mkdir in evil_macro_wrapper */
|
#include <sys/stat.h> /* for mkdir in evil_macro_wrapper */
|
||||||
|
|
||||||
|
|
||||||
#ifdef EAPI
|
#ifdef EVIL_API
|
||||||
# undef EAPI
|
#error EVIL_API should not be already defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EFL_BUILD
|
#ifdef _WIN32
|
||||||
# ifdef DLL_EXPORT
|
# ifndef EVIL_STATIC
|
||||||
# define EAPI __declspec(dllexport)
|
# ifdef EVIL_BUILD
|
||||||
|
# define EVIL_API __declspec(dllexport)
|
||||||
|
# else
|
||||||
|
# define EVIL_API __declspec(dllimport)
|
||||||
|
# endif
|
||||||
# else
|
# else
|
||||||
# define EAPI
|
# define EVIL_API
|
||||||
|
# endif
|
||||||
|
# define EVIL_API_WEAK
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
# if __GNUC__ >= 4
|
||||||
|
# define EVIL_API __attribute__ ((visibility("default")))
|
||||||
|
# define EVIL_API_WEAK __attribute__ ((weak))
|
||||||
|
# else
|
||||||
|
# define EVIL_API
|
||||||
|
# define EVIL_API_WEAK
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define EAPI __declspec(dllimport)
|
/**
|
||||||
|
* @def EVIL_API
|
||||||
|
* @brief Used to export functions (by changing visibility).
|
||||||
|
*/
|
||||||
|
# define EVIL_API
|
||||||
|
/**
|
||||||
|
* @def EINA_API_WEAK
|
||||||
|
* @brief Weak symbol, primarily useful in defining library functions which
|
||||||
|
* can be overridden in user code.
|
||||||
|
* Note: Not supported on all platforms.
|
||||||
|
*/
|
||||||
|
# define EINA_API_WEAK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
|
@ -61,9 +85,6 @@ extern "C" {
|
||||||
|
|
||||||
#include "evil_macro_wrapper.h"
|
#include "evil_macro_wrapper.h"
|
||||||
|
|
||||||
#undef EAPI
|
|
||||||
#define EAPI
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#undef rename
|
#undef rename
|
||||||
|
|
||||||
int
|
EVIL_API int
|
||||||
evil_rename(const char *src, const char* dst)
|
evil_rename(const char *src, const char* dst)
|
||||||
{
|
{
|
||||||
DWORD res;
|
DWORD res;
|
||||||
|
@ -24,7 +24,7 @@ evil_rename(const char *src, const char* dst)
|
||||||
return MoveFileEx(src, dst, MOVEFILE_REPLACE_EXISTING) ? 0 : -1;
|
return MoveFileEx(src, dst, MOVEFILE_REPLACE_EXISTING) ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
EVIL_API int
|
||||||
evil_mkdir(const char *dirname, mode_t mode EVIL_UNUSED)
|
evil_mkdir(const char *dirname, mode_t mode EVIL_UNUSED)
|
||||||
{
|
{
|
||||||
return _mkdir(dirname);
|
return _mkdir(dirname);
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
*
|
*
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*/
|
*/
|
||||||
EAPI int evil_rename(const char *src, const char *dst);
|
EVIL_API int evil_rename(const char *src, const char *dst);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Wrap the _mkdir() function on Windows.
|
* @brief Wrap the _mkdir() function on Windows.
|
||||||
|
@ -54,7 +54,7 @@ EAPI int evil_rename(const char *src, const char *dst);
|
||||||
*
|
*
|
||||||
* @since 1.15
|
* @since 1.15
|
||||||
*/
|
*/
|
||||||
EAPI int evil_mkdir(const char *dirname, mode_t mode);
|
EVIL_API int evil_mkdir(const char *dirname, mode_t mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
EVIL_API int
|
||||||
setenv(const char *name,
|
setenv(const char *name,
|
||||||
const char *value,
|
const char *value,
|
||||||
int overwrite)
|
int overwrite)
|
||||||
|
@ -65,7 +65,7 @@ setenv(const char *name,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
EVIL_API int
|
||||||
unsetenv(const char *name)
|
unsetenv(const char *name)
|
||||||
{
|
{
|
||||||
return setenv(name, NULL, 1);
|
return setenv(name, NULL, 1);
|
||||||
|
@ -77,7 +77,7 @@ unsetenv(const char *name)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
EVIL_API char *
|
||||||
realpath(const char *file_name, char *resolved_name)
|
realpath(const char *file_name, char *resolved_name)
|
||||||
{
|
{
|
||||||
char *retname = NULL; /* we will return this, if we fail */
|
char *retname = NULL; /* we will return this, if we fail */
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef __EVIL_STDLIB_H__
|
#ifndef __EVIL_STDLIB_H__
|
||||||
#define __EVIL_STDLIB_H__
|
#define __EVIL_STDLIB_H__
|
||||||
|
|
||||||
|
#include "evil_private.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file evil_stdlib.h
|
* @file evil_stdlib.h
|
||||||
|
@ -40,7 +41,7 @@
|
||||||
*
|
*
|
||||||
* Supported OS: Windows XP.
|
* Supported OS: Windows XP.
|
||||||
*/
|
*/
|
||||||
EAPI int setenv(const char *name,
|
EVIL_API int setenv(const char *name,
|
||||||
const char *value,
|
const char *value,
|
||||||
int overwrite);
|
int overwrite);
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ EAPI int setenv(const char *name,
|
||||||
*
|
*
|
||||||
* Supported OS: Windows XP.
|
* Supported OS: Windows XP.
|
||||||
*/
|
*/
|
||||||
EAPI int unsetenv(const char *name);
|
EVIL_API int unsetenv(const char *name);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -96,7 +97,7 @@ EAPI int unsetenv(const char *name);
|
||||||
*
|
*
|
||||||
* Supported OS: Windows XP.
|
* Supported OS: Windows XP.
|
||||||
*/
|
*/
|
||||||
EAPI char *realpath(const char *file_name, char *resolved_name);
|
EVIL_API char *realpath(const char *file_name, char *resolved_name);
|
||||||
#ifndef HAVE_REALPATH
|
#ifndef HAVE_REALPATH
|
||||||
# define HAVE_REALPATH 1
|
# define HAVE_REALPATH 1
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *strcasestr(const char *haystack, const char *needle)
|
EVIL_API char *strcasestr(const char *haystack, const char *needle)
|
||||||
{
|
{
|
||||||
size_t length_needle;
|
size_t length_needle;
|
||||||
size_t length_haystack;
|
size_t length_haystack;
|
||||||
|
@ -50,7 +50,7 @@ char *strcasestr(const char *haystack, const char *needle)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
EVIL_API char *
|
||||||
strsep (char **stringp, const char *delim)
|
strsep (char **stringp, const char *delim)
|
||||||
{
|
{
|
||||||
char *begin, *end;
|
char *begin, *end;
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
*
|
*
|
||||||
* Supported OS: Windows XP.
|
* Supported OS: Windows XP.
|
||||||
*/
|
*/
|
||||||
EAPI char *strcasestr(const char *haystack, const char *needle);
|
EVIL_API char *strcasestr(const char *haystack, const char *needle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Implements the strsep function which is used to separate strings.
|
* @brief Implements the strsep function which is used to separate strings.
|
||||||
|
@ -61,7 +61,7 @@ EAPI char *strcasestr(const char *haystack, const char *needle);
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
EAPI char *strsep(char **stringp, const char *delim);
|
EVIL_API char *strsep(char **stringp, const char *delim);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
|
|
@ -173,7 +173,7 @@ conv_num(const unsigned char *buf, int *dest, unsigned int llim, unsigned int ul
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
EVIL_API char *
|
||||||
strptime(const char *buf, const char *fmt, struct tm *tm)
|
strptime(const char *buf, const char *fmt, struct tm *tm)
|
||||||
{
|
{
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct timezone
|
||||||
*
|
*
|
||||||
* @since 1.25
|
* @since 1.25
|
||||||
*/
|
*/
|
||||||
EAPI int evil_gettimeofday(struct timeval *tv, struct timezone *tz);
|
EVIL_API int evil_gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||||
#ifndef HAVE_GETTIMEOFDAY
|
#ifndef HAVE_GETTIMEOFDAY
|
||||||
# define HAVE_GETTIMEOFDAY 1
|
# define HAVE_GETTIMEOFDAY 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,7 +61,7 @@ EAPI int evil_gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||||
*
|
*
|
||||||
* Supported OS: Windows XP.
|
* Supported OS: Windows XP.
|
||||||
*/
|
*/
|
||||||
EAPI char *strptime(const char *buf, const char *fmt, struct tm *tm);
|
EVIL_API char *strptime(const char *buf, const char *fmt, struct tm *tm);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,7 @@ LONGLONG _evil_time_count;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
double
|
EVIL_API double
|
||||||
evil_time_get(void)
|
evil_time_get(void)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER count;
|
LARGE_INTEGER count;
|
||||||
|
@ -39,7 +39,7 @@ evil_time_get(void)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
EVIL_API int
|
||||||
evil_sockets_init(void)
|
evil_sockets_init(void)
|
||||||
{
|
{
|
||||||
WSADATA wsa_data;
|
WSADATA wsa_data;
|
||||||
|
@ -61,7 +61,7 @@ evil_sockets_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
EVIL_API void
|
||||||
evil_sockets_shutdown(void)
|
evil_sockets_shutdown(void)
|
||||||
{
|
{
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
|
@ -71,7 +71,7 @@ evil_sockets_shutdown(void)
|
||||||
* The code of the following functions has been kindly offered
|
* The code of the following functions has been kindly offered
|
||||||
* by Tor Lillqvist.
|
* by Tor Lillqvist.
|
||||||
*/
|
*/
|
||||||
int
|
EVIL_API int
|
||||||
evil_pipe(int *fds)
|
evil_pipe(int *fds)
|
||||||
{
|
{
|
||||||
struct sockaddr_in saddr;
|
struct sockaddr_in saddr;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef __EVIL_UNISTD_H__
|
#ifndef __EVIL_UNISTD_H__
|
||||||
#define __EVIL_UNISTD_H__
|
#define __EVIL_UNISTD_H__
|
||||||
|
|
||||||
|
#include "evil_private.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file evil_unistd.h
|
* @file evil_unistd.h
|
||||||
|
@ -34,7 +35,7 @@
|
||||||
*
|
*
|
||||||
* Supported OS: Windows XP.
|
* Supported OS: Windows XP.
|
||||||
*/
|
*/
|
||||||
EAPI double evil_time_get(void);
|
EVIL_API double evil_time_get(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sockets and pipe related functions
|
* Sockets and pipe related functions
|
||||||
|
@ -53,7 +54,7 @@ EAPI double evil_time_get(void);
|
||||||
*
|
*
|
||||||
* Supported OS: Windows XP.
|
* Supported OS: Windows XP.
|
||||||
*/
|
*/
|
||||||
EAPI int evil_sockets_init(void);
|
EVIL_API int evil_sockets_init(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Shutdown the Windows socket system.
|
* @brief Shutdown the Windows socket system.
|
||||||
|
@ -64,7 +65,7 @@ EAPI int evil_sockets_init(void);
|
||||||
*
|
*
|
||||||
* Supported OS: Windows XP.
|
* Supported OS: Windows XP.
|
||||||
*/
|
*/
|
||||||
EAPI void evil_sockets_shutdown(void);
|
EVIL_API void evil_sockets_shutdown(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create a pair of sockets.
|
* @brief Create a pair of sockets.
|
||||||
|
@ -80,7 +81,7 @@ EAPI void evil_sockets_shutdown(void);
|
||||||
*
|
*
|
||||||
* Supported OS: Windows XP.
|
* Supported OS: Windows XP.
|
||||||
*/
|
*/
|
||||||
EAPI int evil_pipe(int *fds);
|
EVIL_API int evil_pipe(int *fds);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,7 +15,7 @@ DWORD _evil_tls_index;
|
||||||
/* static void _evil_error_display(const char *fct, LONG res); */
|
/* static void _evil_error_display(const char *fct, LONG res); */
|
||||||
static void _evil_last_error_display(const char *fct);
|
static void _evil_last_error_display(const char *fct);
|
||||||
|
|
||||||
wchar_t *
|
EVIL_API wchar_t *
|
||||||
evil_char_to_wchar(const char *text)
|
evil_char_to_wchar(const char *text)
|
||||||
{
|
{
|
||||||
wchar_t *wtext;
|
wchar_t *wtext;
|
||||||
|
@ -44,7 +44,7 @@ evil_char_to_wchar(const char *text)
|
||||||
return wtext;
|
return wtext;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
EVIL_API char *
|
||||||
evil_wchar_to_char(const wchar_t *text)
|
evil_wchar_to_char(const wchar_t *text)
|
||||||
{
|
{
|
||||||
char *atext;
|
char *atext;
|
||||||
|
@ -74,7 +74,7 @@ evil_wchar_to_char(const wchar_t *text)
|
||||||
return atext;
|
return atext;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
EVIL_API char *
|
||||||
evil_utf16_to_utf8(const wchar_t *text16)
|
evil_utf16_to_utf8(const wchar_t *text16)
|
||||||
{
|
{
|
||||||
char *text8;
|
char *text8;
|
||||||
|
@ -107,7 +107,7 @@ evil_utf16_to_utf8(const wchar_t *text16)
|
||||||
return text8;
|
return text8;
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t *
|
EVIL_API wchar_t *
|
||||||
evil_utf8_to_utf16(const char *text)
|
evil_utf8_to_utf16(const char *text)
|
||||||
{
|
{
|
||||||
wchar_t *text16;
|
wchar_t *text16;
|
||||||
|
@ -135,7 +135,7 @@ evil_utf8_to_utf16(const char *text)
|
||||||
return text16;
|
return text16;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
EVIL_API const char *
|
||||||
evil_format_message(long err)
|
evil_format_message(long err)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
|
@ -174,7 +174,7 @@ evil_format_message(long err)
|
||||||
return (const char *)buf;
|
return (const char *)buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
EVIL_API const char *
|
||||||
evil_last_error_get(void)
|
evil_last_error_get(void)
|
||||||
{
|
{
|
||||||
DWORD err;
|
DWORD err;
|
||||||
|
@ -189,7 +189,7 @@ _evil_last_error_display(const char *fct)
|
||||||
fprintf(stderr, "[Evil] [%s] ERROR: %s\n", fct, evil_last_error_get());
|
fprintf(stderr, "[Evil] [%s] ERROR: %s\n", fct, evil_last_error_get());
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
EVIL_API int
|
||||||
evil_path_is_absolute(const char *path)
|
evil_path_is_absolute(const char *path)
|
||||||
{
|
{
|
||||||
size_t length;
|
size_t length;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
* @ingroup Evil
|
* @ingroup Evil
|
||||||
*/
|
*/
|
||||||
EAPI wchar_t *evil_char_to_wchar(const char *text);
|
EVIL_API wchar_t *evil_char_to_wchar(const char *text);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Convert a string from wchar_t * to char *.
|
* @brief Convert a string from wchar_t * to char *.
|
||||||
|
@ -38,7 +38,7 @@ EAPI wchar_t *evil_char_to_wchar(const char *text);
|
||||||
*
|
*
|
||||||
* @ingroup Evil
|
* @ingroup Evil
|
||||||
*/
|
*/
|
||||||
EAPI char *evil_wchar_to_char(const wchar_t *text);
|
EVIL_API char *evil_wchar_to_char(const wchar_t *text);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Convert a string from UTF-16 to UTF-8.
|
* @brief Convert a string from UTF-16 to UTF-8.
|
||||||
|
@ -57,7 +57,7 @@ EAPI char *evil_wchar_to_char(const wchar_t *text);
|
||||||
*
|
*
|
||||||
* @ingroup Evil
|
* @ingroup Evil
|
||||||
*/
|
*/
|
||||||
EAPI char *evil_utf16_to_utf8(const wchar_t *text);
|
EVIL_API char *evil_utf16_to_utf8(const wchar_t *text);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Convert a string from UTF-8 to UTF-16.
|
* @brief Convert a string from UTF-8 to UTF-16.
|
||||||
|
@ -75,11 +75,11 @@ EAPI char *evil_utf16_to_utf8(const wchar_t *text);
|
||||||
*
|
*
|
||||||
* @ingroup Evil
|
* @ingroup Evil
|
||||||
*/
|
*/
|
||||||
EAPI wchar_t *evil_utf8_to_utf16(const char *text);
|
EVIL_API wchar_t *evil_utf8_to_utf16(const char *text);
|
||||||
|
|
||||||
EAPI const char *evil_format_message(long err);
|
EVIL_API const char *evil_format_message(long err);
|
||||||
|
|
||||||
EAPI const char *evil_last_error_get(void);
|
EVIL_API const char *evil_last_error_get(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief check if the given path is absolute.
|
* @brief check if the given path is absolute.
|
||||||
|
@ -102,6 +102,6 @@ EAPI const char *evil_last_error_get(void);
|
||||||
*
|
*
|
||||||
* @ingroup Evil
|
* @ingroup Evil
|
||||||
*/
|
*/
|
||||||
EAPI int evil_path_is_absolute(const char *path);
|
EVIL_API int evil_path_is_absolute(const char *path);
|
||||||
|
|
||||||
#endif /* __EVIL_UTIL_H__ */
|
#endif /* __EVIL_UTIL_H__ */
|
||||||
|
|
|
@ -29,7 +29,7 @@ if target_machine.system() == 'windows'
|
||||||
evil_ext_deps += [psapi, ole32, ws2_32, secur32, uuid, regexp]
|
evil_ext_deps += [psapi, ole32, ws2_32, secur32, uuid, regexp]
|
||||||
|
|
||||||
evil_lib = library('evil', evil_src,
|
evil_lib = library('evil', evil_src,
|
||||||
c_args : package_c_args,
|
c_args : [package_c_args, '-DEVIL_BUILD'],
|
||||||
dependencies : evil_ext_deps,
|
dependencies : evil_ext_deps,
|
||||||
include_directories : [config_dir],
|
include_directories : [config_dir],
|
||||||
install: true,
|
install: true,
|
||||||
|
|
Loading…
Reference in New Issue