* Remove Windows code in evas_module.c and use evilness instead

* Allow Windows Mobile to correctly load dll's
 * Use correct scheme for EAPI on Windows and include config.h when necessary
 * add -mwin32 to compiler flags when compiling with cegcc


SVN revision: 34024
This commit is contained in:
doursse 2008-03-14 16:49:49 +00:00 committed by doursse
parent 56b68a7ba4
commit 219831980f
26 changed files with 100 additions and 126 deletions

View File

@ -35,12 +35,23 @@ MODULE_ARCH="$host_os-$host_cpu"
AC_SUBST(MODULE_ARCH)
AC_DEFINE_UNQUOTED(MODULE_ARCH, "$MODULE_ARCH", "Module architecture")
PKG_PROG_PKG_CONFIG
WIN32_CFLAGS=""
create_shared_lib=""
case "$host_os" in
mingw|mingw32)
mingw|mingw32*|cegcc)
PKG_CHECK_MODULES(EVIL, evil)
AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed])
dnl needed for correct definition of EAPI
AC_DEFINE(EFL_EVAS_BUILD, 1, [Define to mention that evas is built])
if test "$host_os" = "cegcc" ; then
WIN32_CFLAGS="-mwin32"
fi
create_shared_lib="-no-undefined "
;;
esac
AC_SUBST(WIN32_CFLAGS)
AC_SUBST(create_shared_lib)
x_dir=""

View File

@ -2,14 +2,19 @@
#define _EVAS_H
#ifdef EAPI
#undef EAPI
# undef EAPI
#endif
#ifdef _MSC_VER
# ifdef BUILDING_DLL
# define EAPI __declspec(dllexport)
#ifdef _WIN32
# ifdef EFL_EVAS_BUILD
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# else
# define EAPI
# endif /* ! DLL_EXPORT */
# else
# define EAPI __declspec(dllimport)
# endif
# endif /* ! EFL_EVAS_BUILD */
#else
# ifdef __GNUC__
# if __GNUC__ >= 4
@ -20,7 +25,7 @@
# else
# define EAPI
# endif
#endif
#endif /* ! _WIN32 */
/**
* @file

View File

@ -12,6 +12,7 @@ AM_CPPFLAGS = -I. \
@FREETYPE_CFLAGS@ \
@EET_CFLAGS@ \
@FONTCONFIG_CFLAGS@ \
@WIN32_CFLAGS@ \
@pthread_cflags@
lib_LTLIBRARIES = libevas.la

View File

@ -1,5 +1,4 @@
#include <assert.h>
#include <Evas.h>
#include "evas_common.h"
#include "evas_private.h"

View File

@ -1,6 +1,5 @@
#include <stdlib.h>
#include <assert.h>
#include <Evas.h>
#include "evas_common.h"
#include "evas_private.h"

View File

@ -10,7 +10,8 @@ AM_CPPFLAGS = -I. \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
@FREETYPE_CFLAGS@ @VALGRIND_CFLAGS@ \
@EET_CFLAGS@ @pthread_cflags@
@EET_CFLAGS@ @pthread_cflags@ \
@WIN32_CFLAGS@
noinst_LTLIBRARIES = libevas_engine_common.la
libevas_engine_common_la_SOURCES = \

View File

@ -1,12 +1,16 @@
#ifdef HAVE_CONFIG_H
# include "config.h" /* so that EAPI in Eet.h is correctly defined */
#endif
#ifdef BUILD_LOADER_EET
# include <Eet.h>
#endif
#include "evas_common.h"
#include "evas_private.h"
#ifdef BUILD_LOADER_EET
#include <Eet.h>
#endif
#ifdef HAVE_VALGRIND
#include <memcheck.h>
# include <memcheck.h>
#endif
static Evas_Cache_Image * eci = NULL;

View File

@ -7,11 +7,12 @@ AM_CPPFLAGS = -I. \
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
@FREETYPE_CFLAGS@
@FREETYPE_CFLAGS@ \
@EVIL_CFLAGS@ @WIN32_CFLAGS@
noinst_LTLIBRARIES = libevas_file.la
libevas_file_la_SOURCES = \
evas_path.c \
evas_module.c
libevas_file_la_LIBADD = @EVIL_LIBS@
libevas_file_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -5,86 +5,11 @@
#endif
#include <dirent.h> /* DIR, dirent */
#ifdef _WIN32
# include <windows.h>
# include <stdlib.h>
# include <stdio.h>
#else
# include <dlfcn.h> /* dlopen,dlclose,etc */
#endif
#include <dlfcn.h> /* dlopen,dlclose,etc */
#include <evas_common.h>
#include <evas_private.h>
/* FIXME: that hack is a temporary one. That code will be in MinGW soon */
#ifdef _WIN32
# define RTLD_LAZY 1 /* lazy function call binding */
# define RTLD_NOW 2 /* immediate function call binding */
# define RTLD_GLOBAL 4 /* symbols in this dlopen'ed obj are visible
to other dlopen'ed objs */
static char *dlerr_ptr;
static char dlerr_data[80];
void *dlopen (const char *file, int mode)
{
HMODULE hmodule;
hmodule = LoadLibrary(file);
if (hmodule == NULL) {
int error;
error = GetLastError();
sprintf(dlerr_data, "LoadLibraryEx returned %d.", error);
dlerr_ptr = dlerr_data;
}
return hmodule;
}
int dlclose (void *handle)
{
if (FreeLibrary(handle)) {
return 0;
}
else {
int error;
error = GetLastError();
sprintf(dlerr_data, "FreeLibrary returned %d.", error);
dlerr_ptr = dlerr_data;
return -1;
}
}
void *dlsym (void *handle, const char *name)
{
FARPROC fp;
fp = GetProcAddress(handle, name);
if (fp == NULL) {
int error;
error = GetLastError();
sprintf(dlerr_data, "GetProcAddress returned %d.", error);
dlerr_ptr = dlerr_data;
}
return fp;
}
char *dlerror (void)
{
if (dlerr_ptr != NULL) {
dlerr_ptr = NULL;
return dlerr_data;
}
else {
return NULL;
}
}
#endif /* _WIN32 */
Evas_List *evas_modules = NULL;
static Evas_List *evas_module_paths = NULL;
@ -311,7 +236,21 @@ evas_module_load(Evas_Module *em)
if (em->loaded) return 1;
/* printf("LOAD %s\n", em->name); */
#ifdef _WIN32
#if defined(__CEGCC__) || defined(__MINGW32CE__)
switch (em->type) {
case EVAS_MODULE_TYPE_IMAGE_SAVER:
snprintf(buf, sizeof(buf), "%s/%s/%s/saver_%s.dll", em->path, em->name, MODULE_ARCH, em->name);
break;
case EVAS_MODULE_TYPE_IMAGE_LOADER:
snprintf(buf, sizeof(buf), "%s/%s/%s/loader_%s.dll", em->path, em->name, MODULE_ARCH, em->name);
break;
case EVAS_MODULE_TYPE_ENGINE:
snprintf(buf, sizeof(buf), "%s/%s/%s/engine_%s.dll", em->path, em->name, MODULE_ARCH, em->name);
break;
default:
snprintf(buf, sizeof(buf), "%s/%s/%s/object_%s.dll", em->path, em->name, MODULE_ARCH, em->name);
}
#elif _WIN32
snprintf(buf, sizeof(buf), "%s/%s/%s/module.dll", em->path, em->name, MODULE_ARCH);
#else
snprintf(buf, sizeof(buf), "%s/%s/%s/module.so", em->path, em->name, MODULE_ARCH);

View File

@ -1,10 +1,14 @@
#include "evas_common.h"
#include "evas_private.h"
#ifdef HAVE_CONFIG_H
# include "config.h" /* so that EAPI in Eet.h is correctly defined */
#endif
#ifdef BUILD_FONT_LOADER_EET
#include <Eet.h>
#endif
#include "evas_common.h"
#include "evas_private.h"
EAPI Evas_Imaging_Image *
evas_imaging_image_load(const char *file, const char *key)
{

View File

@ -5,8 +5,11 @@
#ifndef EVAS_COMMON_H
#define EVAS_COMMON_H
#ifdef HAVE_CONFIG_H
# include "config.h" /* so that EAPI in Evas.h is correctly defined */
#endif
#include "Evas.h"
#include "config.h"
/*****************************************************************************/
@ -72,10 +75,6 @@ extern "C"
void *alloca (size_t);
#endif
#ifdef _WIN32_WCE
#include <windows.h>
#endif
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
@ -126,15 +125,7 @@ void *alloca (size_t);
/*****************************************************************************/
#ifndef _WIN32_WCE
typedef unsigned long long DATA64;
#else
typedef unsigned __int64 DATA64;
#define strdup _strdup
#define snprintf _snprintf
#define rewind(f) fseek(f, 0, SEEK_SET)
#endif
typedef unsigned int DATA32;
typedef unsigned short DATA16;
typedef unsigned char DATA8;

View File

@ -1,4 +1,3 @@
#include "Evas.h"
#include "evas_common.h"
#include "evas_private.h"

View File

@ -6,7 +6,8 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
-I$(top_srcdir)/src/modules/engines \
@FREETYPE_CFLAGS@
@FREETYPE_CFLAGS@ \
@WIN32_CFLAGS@
if BUILD_ENGINE_BUFFER

View File

@ -6,7 +6,8 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
-I$(top_srcdir)/src/modules/engines \
@FREETYPE_CFLAGS@
@FREETYPE_CFLAGS@ \
@WIN32_CFLAGS@
if BUILD_ENGINE_SOFTWARE_16

View File

@ -6,7 +6,8 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
-I$(top_srcdir)/src/modules/engines \
@FREETYPE_CFLAGS@
@FREETYPE_CFLAGS@ \
@WIN32_CFLAGS@
pkgdir = $(libdir)/evas/modules/engines/software_generic/$(MODULE_ARCH)

View File

@ -7,7 +7,8 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib/include \
-I$(top_srcdir)/src/modules/engines \
@FREETYPE_CFLAGS@ \
@SDL_CFLAGS@
@SDL_CFLAGS@ \
@WIN32_CFLAGS@
if BUILD_ENGINE_SDL

View File

@ -4,7 +4,8 @@ MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = -I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ @EET_CFLAGS@
@FREETYPE_CFLAGS@ @EET_CFLAGS@ \
@WIN32_CFLAGS@
pkgdir = $(libdir)/evas/modules/loaders/eet/$(MODULE_ARCH)

View File

@ -1,8 +1,12 @@
#include "evas_common.h"
#include "evas_private.h"
#ifdef HAVE_CONFIG_H
# include "config.h" /* so that EAPI in Eet.h is correctly defined */
#endif
#include <Eet.h>
#include "evas_common.h"
#include "evas_private.h"
int evas_image_load_file_head_eet(RGBA_Image *im, const char *file, const char *key);
int evas_image_load_file_data_eet(RGBA_Image *im, const char *file, const char *key);

View File

@ -4,7 +4,8 @@ MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = -I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ @jpeg_cflags@
@FREETYPE_CFLAGS@ @jpeg_cflags@ \
@WIN32_CFLAGS@
pkgdir = $(libdir)/evas/modules/loaders/jpeg/$(MODULE_ARCH)

View File

@ -4,7 +4,8 @@ MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = -I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ @pmaps_cflags@
@FREETYPE_CFLAGS@ @pmaps_cflags@ \
@WIN32_CFLAGS@
pkgdir = $(libdir)/evas/modules/loaders/pmaps/$(MODULE_ARCH)

View File

@ -4,7 +4,8 @@ MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = -I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ @PNG_CFLAGS@
@FREETYPE_CFLAGS@ @PNG_CFLAGS@ \
@WIN32_CFLAGS@
pkgdir = $(libdir)/evas/modules/loaders/png/$(MODULE_ARCH)

View File

@ -4,7 +4,8 @@ MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = -I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ @xpm_cflags@
@FREETYPE_CFLAGS@ @xpm_cflags@ \
@WIN32_CFLAGS@
pkgdir = $(libdir)/evas/modules/loaders/xpm/$(MODULE_ARCH)

View File

@ -4,7 +4,8 @@ MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = -I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ @EET_CFLAGS@
@FREETYPE_CFLAGS@ @EET_CFLAGS@ \
@WIN32_CFLAGS@
pkgdir = $(libdir)/evas/modules/savers/eet/$(MODULE_ARCH)

View File

@ -1,8 +1,12 @@
#include "evas_common.h"
#include "evas_private.h"
#ifdef HAVE_CONFIG_H
# include "config.h" /* so that EAPI in Eet.h is correctly defined */
#endif
#include <Eet.h>
#include "evas_common.h"
#include "evas_private.h"
int evas_image_save_file_eet(RGBA_Image *im, const char *file, const char *key, int quality, int compress);
Evas_Image_Save_Func evas_image_save_eet_func =

View File

@ -4,7 +4,8 @@ MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = -I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ @jpeg_cflags@
@FREETYPE_CFLAGS@ @jpeg_cflags@ \
@WIN32_CFLAGS@
pkgdir = $(libdir)/evas/modules/savers/jpeg/$(MODULE_ARCH)

View File

@ -4,7 +4,8 @@ MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = -I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ @PNG_CFLAGS@
@FREETYPE_CFLAGS@ @PNG_CFLAGS@ \
@WIN32_CFLAGS@
pkgdir = $(libdir)/evas/modules/savers/png/$(MODULE_ARCH)