|
From: | Aleksander Morgado |
Subject: | Re: [pdf-devel] Compiling for windows |
Date: | Thu, 17 Apr 2008 23:58:54 +0200 |
User-agent: | Thunderbird 2.0.0.12 (Macintosh/20080213) |
I started the development of FS#15 (Windows host encoding support), and found a small problem in the pdf-stm-file.c file: S_IRGRP and S_IROTH are not defined in windows (no way to deal with permissions for group or others). Well, it seems we have reached the point where we should introduce conditional compilation depending on the plattform. To use generic code able to compile in all plattform may be a solution for this specific issue, but we will surely find situations where we will need to use code A for one plattform and code B for anotherplattform.
The host encoding conversion in the Text Module, for example. `iconv' is used for all POSIX, except for Windows, where its own API is used.
We need some kind of preprocessor definitions determining the host plattform.
At least for the text module, I was using these lines to check if the host OS was WIN32 (in a similar way as done within the modules imported from gnulib):
#if defined _WIN32 || defined __WIN32__ #define WIN32_NATIVE #endif And an example of use: #ifdef WIN32_NATIVE #include <windows.h> #else #include <iconv.h> #include <errno.h> #include <string.h> #endif
After correcting this bug everything compiles correctly with mingw32 cross-compiling. Please dont commit this patch. Lets solve the problem in a general way instead.
IMHO this change should not depend on the platform itself, but in the availability of the flags, which is the thing being checked.
[Prev in Thread] | Current Thread | [Next in Thread] |