[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Mingw support for grub2

From: Christian Franke
Subject: Re: [PATCH] Mingw support for grub2
Date: Sun, 24 Aug 2008 14:40:53 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080702 SeaMonkey/1.1.11

Bean wrote:

This patch add support for mingw, now you can create native executable
for windows.


Does grub-setup work?

--- a/include/grub/util/misc.h
+++ b/include/grub/util/misc.h
+#ifdef __MINGW32__
+#include <windows.h>
+grub_int64_t fseeko (FILE *fp, grub_int64_t offset, int whence);
+grub_int64_t ftello (FILE *fp);

The mingw runtime provides fseeko64/ftello64(), see /usr/include/mingw/stdio.h

So the following may work:

#ifdef __MINGW32__
#define fseeko fseeko64
#define ftello ftello64

or use inline functions.

+void sync (void);
+int asprintf (char **buf, const char *fmt, ...);

I would suggest to add AC_CHECK_FUNC(asprintf) to configure.
asprintf() is a GNU extension and not part of C99 or POSIX.

+grub_int64_t grub_util_get_disk_size (char *name);
+#define sleep  Sleep

The Sleep() parameter specifies milliseconds.

#define sleep(s) Sleep((s)*1000)
inline void sleep(unsigned s) { Sleep(s * 1000); }
add sleep() to util/misc.c to avoid global inclusion of the namespace polluter windows.h :-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]