I am a windows mobile developper and I tried to compile DevIL for this platform.
First it would be better to provide a Visual Studio 2005 project and solution.
Once you have converted the embedded visual project to VS2005, include paths are missing :
Add to
DevIL : ..\..\..\src-IL\include;..\..\..\include
ILU : ..\..\..\src-ILU\include;..\..\..\include
ILUT: ..\..\..\src-ILUT\include;..\..\..\include
Once you have fixed paths, there is issues because of a missing #ifdef.
Project is trying to compile a x86 asm while generally ARM is used on mobile devices.
Please add #ifndef UNDER_CE to il_internal.h (L79):
Hi,
I am a windows mobile developper and I tried to compile DevIL for this platform.
First it would be better to provide a Visual Studio 2005 project and solution.
Once you have converted the embedded visual project to VS2005, include paths are missing :
Add to
DevIL : ..\..\..\src-IL\include;..\..\..\include
ILU : ..\..\..\src-ILU\include;..\..\..\include
ILUT: ..\..\..\src-ILUT\include;..\..\..\include
Once you have fixed paths, there is issues because of a missing #ifdef.
Project is trying to compile a x86 asm while generally ARM is used on mobile devices.
Please add #ifndef UNDER_CE to il_internal.h (L79):
#ifdef IL_INLINE_ASM
#ifdef _MSC_VER // MSVC++ only
#ifndef UNDER_CE
#define USE_WIN32_ASM
#endif
#endif
#endif
Here are the other errors :
src-ILU\src\ilu_states.c:
..\..\..\src-ILU\src\ilu_states.c(18) : warning C4133: 'initializing' : incompatible types - from 'char *' to 'const wchar_t *'
..\..\..\src-ILU\src\ilu_states.c(19) : error C2308: concatenating mismatched strings
Concatenating wide "Developer's Image Library Utilities (ILU) 1.6.7 " with narrow "Feb 19 2008"
..\..\..\src-ILU\src\ilu_states.c(19) : warning C4133: 'initializing' : incompatible types - from 'char *' to 'const wchar_t *'
IL_TEXT is defined like this
// From DevIL's internal.h:
#ifdef _WIN32_WCE
#include <windows.h>
#define IL_TEXT(s) ((char*)TEXT(s))
...
While it should be defined like this
#ifdef _UNICODE
#define __IL_TEXT(s) L##s
#define IL_TEXT(s) __IL_TEXT(s)
#else
#define __IL_TEXT(s) (s)
#define IL_TEXT(s) __IL_TEXT(s)
#endif
What are you redefining these macros two times(ilu_internal.h and il_internal.h) ???? Seems like a quick fix.
replace
const ILstring _iluVersion = IL_TEXT("Developer's Image Library Utilities (ILU) 1.6.7 " __DATE__)
by
const ILstring _iluVersion = IL_TEXT("Developer's Image Library Utilities (ILU) 1.6.7 ") IL_TEXT( __DATE__ ) ;
ilu_error.c has a typo error : return TEXT("no error"); should be IL_TEXT
After I tried to fix it but it seems that you have made the choice to use too many char*.
For instance
ILstring _ilLoadExt = "" IL_BMP_EXT IL_CUT_EXT IL_DCX_EXT IL_DDS_EXT
IL_GIF_EXT IL_HDR_EXT IL_ICO_EXT IL_JPG_EXT IL_LIF_EXT
IL_MDL_EXT IL_MNG_EXT IL_PCX_EXT IL_PIC_EXT
IL_PIX_EXT IL_PNG_EXT IL_PNM_EXT IL_PSD_EXT
IL_PSP_EXT IL_PXR_EXT IL_SGI_EXT IL_TGA_EXT
IL_TIF_EXT IL_WAL_EXT IL_XPM_EXT;
ILstring is defined like a wchar_t* but all IL_XYZ_EXT macros are defined like char*.
char *iClipString(char *String, ILuint MaxLen) {...}
char *iGetString(ILenum StringName) {...}
ILvoid ILAPIENTRY ilSetString(ILenum Mode, const char *String) {...}
maybe it would be better to replace char* by ILstring:
Finally what you should do is to define a iltchar.h :
#ifndef ILTCHAR_H
#define ILTCHAR_H
#if defined(WIN32) || defined(UNDER_CE)
#include <stdio.h>
#include <tchar.h>
#else
#define _TEOF EOF
#define TCHAR char
#define __T(x) x
#define _tmain main
#define _tWinMain WinMain
#ifdef _POSIX_
#define _tenviron environ
#else
#define _tenviron _environ
#endif
#define __targv __argv
#define _tcsclen strlen
#define _topen open
#endif //ILTCHAR_H
where you would define unicode and ansi functions:
and you would be able to declare :
ILstring iClipString(ILstring String, ILuint MaxLen)
{
ILstring Clipped;
ILuint Length;
if (String == NULL)
return NULL;
Length = _tcslen(String);
Clipped = (TCHAR*)ialloc(MaxLen * sizeof(TCHAR) + 1); // Terminating NULL makes it +1.
if (Clipped == NULL) {
return NULL;
}
memcpy(Clipped, String, Length * sizeof(TCHAR));
Clipped[Length] = 0;
return Clipped;
}
I will do the modifications but I would like to talk with the official maintainer, to know its opinion.
Vincent Richomme
richom [DOT] v [AT] free [DOT] fr