FU Logo
  • Startseite
  • Kontakt
  • Impressum
  • Home
  • Listenauswahl
  • Anleitungen

[linux-minidisc] compiling libnetmd and netmdcli on windows

<-- thread -->
<-- date -->
  • From: Thomas Arp <manner.moe@gmx.de>
  • To: linux-minidisc@lists.fu-berlin.de
  • Date: Tue, 13 Sep 2011 09:03:06 +0200
  • Subject: [linux-minidisc] compiling libnetmd and netmdcli on windows

Hi, if found some incompatibilities when compiling on windows/mingw32.

1. libnetmd/common.c :  sleep() is not defined/implemented
I fixed this using windows Sleep() function by adding following lines to common.c

#ifdef WIN32 /* use windows internal Sleep() function */
    #include <windows.h>
    #define sleep(x) Sleep(x)
#endif

2. libnetmd/utils.h and utils.c :  "int min(int a,int b)" is already defined in windows.h
I fixed this by defining NOMINMAX to not use the windows function.
I just added following line to libnetmd.pro and netmdcli.pro

win32:DEFINES += NOMINMAX

3. libnetmd/utils.h :  missind definition of ETIMEDOUT in errno.h
I fixed this by defining it.

#ifdef WIN32 /* add missing definitions for errno on windows */
    #define ETIMEDOUT 70 // Operation timed out
#endif

4. libnetmd/secure.c and netmdcli/netmdcli.c :  ramdom() is not defined and implemented
I fixed this as a "bloody hack" in utils.h using
#ifdef WIN32
    #include <stdlib.h>
    #include <time.h>
    static int random(){srand(time(NULL));return rand();};
#endif

But i think it´s better to use a rondom number generating function which is available on all platforms, maybe use one from libgcrypt.

I´ll send a patch later after we have discussed the random() problem.

Regards
Thomas



<-- thread -->
<-- date -->
  • Follow-Ups:
    • Re: [linux-minidisc] compiling libnetmd and netmdcli on windows
      • From: Michael Karcher <Michael.Karcher@fu-berlin.de>
  • linux-minidisc - September 2011 - Archives indexes sorted by:
    [ thread ] [ subject ] [ author ] [ date ]
  • Complete archive of the linux-minidisc mailing list
  • More info on this list...

Hilfe

  • FAQ
  • Dienstbeschreibung
  • ZEDAT Beratung
  • postmaster@lists.fu-berlin.de

Service-Navigation

  • Startseite
  • Listenauswahl

Einrichtung Mailingliste

  • ZEDAT-Portal
  • Mailinglisten Portal