Comment Re:Mainsoft (Re: Porting Win32 Code to Linux?) (Score 1) 10
Mainwin, at least, as of 6 months ago, was completely useless. Yes, it did successfully emulate the Win32 APIs. Unfortunately, it had about 10 times as many bugs as running natively on these APIs; Many of these bugs could either not be worked around, or were very difficult to work around. The company I was working for was porting their software from Windows to Unix using Mainwin, and eventually got tired of waiting for Yet Another Mainwin Patch to fix these critical bugs that prevented us from shipping. Perhaps Mainwin on Linux is better than Mainwin on Solaris, but... For the price we were paying them, we expected much more than we got. (Part of the price problem, however, is that their code includes parts of the NT source, and as such, they are required to license according to Microsoft terms -- i.e. you have to pay a per-seat runtime license for your software. For every copy of your software that sells, part of that goes to Mainsoft, and in turn, part of that goes to Microsoft.)
As far as the issue of types goes...
- CHAR == char
- WCHAR == wchar_t
- TCHAR == ( unicode ? wchar_t : char )
The only real issue with MS types on non-MS compilers are the random MS extensions, which include 'uuid' attributes (for COM integration, basically), and unnamed structs, which many compilers don't support -- i.e. like:
union { int i; struct { char a; char b; }; };
In the above example, i and a are both located at offset 0 from the start of the struct, and b is located at offset sizeof(char) from the start of the struct. Normally, you would have to use:
union { int i; struct { char a; char b; } foo; };
and access a and b as foo.a and foo.b.
Not that it's a simple matter to handle the weird MS types, but it's a surmountable issue if you are willing to get into typedefs and some preprocessor ugliness.