Using Microsoft C++ Toolkit with Wine

Dan Kegel dank at
Fri Oct 22 07:56:15 CDT 2004

I've posted about this before, but never really tied things
up in a neat package, so:

Here's a document that describes how to
use Microsoft C++ Toolkit on Linux to build
Windows programs:

I hope that helps a few people.  I certainly find
it convenient when writing Wine conformance tests.

To build a Wine conformance test standalone,
I start the test off with the lines

#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include "wine/test.h"
#define ok2 ok
#include <assert.h>
#include <stdio.h>
#define START_TEST(name) main(int argc, char **argv)
#define ok(condition, msg) \
         do { \
                 if(!(condition)) \
                 { \
                         fprintf(stderr,"failed at %d, msg:" msg "\n",__LINE__); \
                         exit(0); \
                 } \
         } while(0)
#define ok2(condition, msg, arg) \
         do { \
                 if(!(condition)) \
                 { \
                         fprintf(stderr,"failed at %d, msg:" msg "\n",__LINE__, arg); \
                         exit(0); \
                 } \
         } while(0)
#define todo_wine
#include <winerror.h>

and use ok2 for those calls to ok that have one argument after the format string.
That .c file should be fine for either normal or standalone use.
(I haven't tested ok2 yet under the normal wine build, but I think #define ok2 ok should work.)

Then I can compile with
   cl -DSTANDALONE -D_X86_ myfile.c
and get a quickie Windows executable for just that test file.

- Dan

Trying to get a job as a c++ developer?  See

More information about the wine-devel mailing list