Skip to main content
Topic: Compile pirate-loader with MinGW ?.. (Read 21 times) previous topic - next topic

Compile pirate-loader with MinGW ?..

Hello,

I've been playing with mingw for a updated PIC programmer, cross platform, console app. I started by compiling the pirate-loader.c for the v4 bootloader - it's a simple single file with all the components needed (HEX parsing, serial coms, etc). In the source it looks like Piotr made POSIX-compatible read, write, close, and open, functions for windows. When I compile with MinGW I get an error that write, read, and open are already defined in io.h (I guess it already has posix substitutes?). I commented out the version in io.h and it compiles and works fine (I tried removing the version in the app, but it didn't work right, opening serial port error). This doesn't seem like an ideal solution. Does anyone have any suggestions? Here's the prototypes for the functions:

From pirate-loader.c:
   int write(int fd, const void* buf, int len)
   int read(int fd, void* buf, int len)
   int open(const char* path, unsigned long flags)

From MinGW io.h:
//_CRTIMP int __cdecl __MINGW_NOTHROW write (int, const void*, unsigned int);
//_CRTIMP int __cdecl __MINGW_NOTHROW read (int, void*, unsigned int);
//_CRTIMP int __cdecl __MINGW_NOTHROW open (const char*, int, ...);

thanks
alexsunny