[Nut-upsdev] windows_port NUT branch

Frédéric Bohé fredericbohe at eaton.com
Thu Dec 16 12:16:33 UTC 2010

On jeu., 2010-12-16 at 12:55 +0300, Paul Fertser wrote:
> Hi,
> Frederic, big thanks for your work on this, by a coincedence it's exactly what
> i need at work :)
> I'm compiling your branch on Debian GNU/Linux with mingw and having some minor
> troubles worth mentioning and (i hope) fixing.
> I configure with
> CC=586-mingw32msvc-gcc ./configure --host=i586-mingw32msvc --prefix=/c/winnut/
> Interestingly, there's scripts/Windows/Makefile in the repo but it gets
> overwritten by the configure process.

The Makefile in the repo is currently not used. It won't prevent nut to
work but needs to be addressed.

> Other minor tweaks i had to do (probably not the most correct way, but i know
> just about nothing wrt windows programming):
> From 26ff6d7fb1ffc6421f1f36243ab9166b8544a9ab Mon Sep 17 00:00:00 2001
> From: Paul Fertser <fercerpav at gmail.com>
> Date: Thu, 16 Dec 2010 12:48:07 +0300
> Subject: [PATCH] mingw32 cross-compilation tweaks
> This adds defines for usleep (windows lacks that) and also missing
> define for SVC_EVENT.

I have no problem compiling with usleep here. Can you give me the error
string you get on this ?
As a side note, beware that your implementation of usleep could lead to
call Sleep(0) (immediate return) if n<1000. usleep is supposed to round
up the time spent depending on system activity and timers granularity.

Concerning SVC_EVENT, it is declared in winevent.h which is a generated
file from winevent.mc as well as a DLL required for the Windows Event
log. Here is how it works:

windmc winevent.mc
windres winevent.rc winevent.o
dllwrap --output-lib=libwinevent.a --dllname=winevent.dll
--driver-name=gcc winevent.o

Note that this should be automated soon in the Makefile.

> Thanks again and happy hacking :)

Thanks for your interest and do not hesitate to send your feedback on
working or non working drivers.



More information about the Nut-upsdev mailing list