Web lists-archives.com

Re: [Mingw-users] Basic bootstrapping-queries on MinGW




Hi Ajay!

On Sat, Nov 5, 2016 at 1:18 PM, Ajay Garg <ajaygargnsit@xxxxxxxxx> wrote:
> Hi All.
>
> We have a framework, ...
>
> Now, we wish to port the framework to Windows.
>
> As the first step, I am wondering if MinGW would be a good choice, as it
> will allow compiling on Linux.
> As a first step, I have got the most minimal portion of the framework ported
> using MinGW, and things "mostly" work on Windows.

MinGW compiles portable c++ code (mostly) fine on windows.

> ...
> However, I see that "usleep" does not work on Windows as expected (it works
> flawlessly on Linux).

MinGW does not emulate unix-style os api's for you.  (If you want something
like that you would need an os emulation layer like cygwin.)

> Bigger beasts like sockets

Windows offers its native socket api's, winsock and winsock2.  There are
some substantive differences between those and unix sockets, but I've found
porting unix socket code to windows to be generally straightforward.

I have used MinGW (actually, a related forked project) to build projects
that used unix sockets on windows.  I had to tweak some of the socket
stuff to make it work with winsock, but it wasn't too bad.

> and multi-threading support still await their turn to be ported to Windows.

There is a windows ports of pthreads, pthreads-win32, that plays well with
MinGW.  MinGW also supports (or can be made to support) c++11's
std::thread if you're willing to use pthreads-win32 underneath.

MinGW also supports the native windows threading api's.  (Unlike sockets,
windows threading is quite different from pthreads, so porting pthreads
code to native windows threading is a lot more than just a few tweaks.)

> With the above back-story, what do the experts think?
> Is it worthwhile to go with MinGW-toolchain (on Linux)? Or we use should
> Visual-Studio (on Windows) itself to compile the framework (as that will
> also provide the luxury of using the MSDN-APIs)?

MinGW supports most of the official windows os api's.  (It doesn't implement
that functionality -- that is in the microsoft dll's that ship with
the os -- but it
does give you headers with the appropriate function declarations.)

If by MSDN-APIs you mean windows os api's, then you should be pretty
well covered.  If you mean api's that are implemented by microsoft products
(including visual studio) other than the windows os itself, then not so much.
But, because you're bringing your framework over from the unix world, I
wouldn't expect that you would be using too much microsoft-specific stuff.

> Will be grateful for pointers.
>
> Thanks and Regards,
> Ajay


Good luck.


K. Frank

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe