Cross-compilation RRS feed

  • Question

  • I was assigned to a task consisting of taking a piece of code built for 16-bit MS-DOS and make it buildable as Win32 (which is not a big deal) while still keeping it buildable also for MS-DOS 6.22 where it is still in use and is being maintained (deal-breaker).

    Now is the code built for target using MSVC 1.52, the last environment from MS that supported 16-bit MS-DOS. I'd like to use Visual Studio 2008 or later as the environment and add a new custom platform configuration to the solution. It seems like it should be a trivial task to tell the environment to use 'this' compiler instead of 'that' compiler using 'these' options. I haven't found any decent way of doing this, is this possible to do?

    Wednesday, April 14, 2010 11:05 AM


All replies

  • Hi, Ben

    This is possible.

    But you need to create a custom project type, and write your own MsBuild Task, in this Msbuild task you could launch your compiler to build your source code.

    For how to create a simple project type,

    See this, Projects Walkthroughs and Project Types.

    And you should write a custom task in your custom project type template, for how to write this task. See this



    Friday, April 16, 2010 6:28 AM
  • Ok, thanks Chao

    Should I interpret this as it currently isn't possible to extend the default Win32 Console project type with a new platform type without having to create a completely new project type? As the target solution already contains a dozen or so projects it would be nice not to have duplicates of every project.

    Friday, April 16, 2010 8:35 AM
  • Hello,

    I am sorry I doesn’t know much about MSVC 1.52, is it a makefile project?

    We could not tell the environment to use 'this' compiler instead of 'that' compiler. But we could create a menu command to our IDE, in this menu command we could launch your MSVC 1.52 to build your project.

    If it is a makefile project, you could open it by visual studio.

    To add a menu command to our IDE, the easiest approach is to create an add-in. For how to do this, the following steps may help.

    1.    For Creating an add-in, See the following link. http://msdn.microsoft.com/en-us/library/80493a3w.aspx

    2.    How to create a menu command, please reference the following.



    3.    In our add-in, we could use Process.Start method to launch your custom compiler, and use Process.OutputDataReceived Event to get the build result. To make the output window to show the build result, see this http://msdn.microsoft.com/en-us/library/ht6z4e28.aspx.



    • Marked as answer by Chao Kuo Wednesday, April 21, 2010 2:20 AM
    Monday, April 19, 2010 3:44 AM
  • Yes, MS Visual C 1.52 was released 1993 and is based on makefiles. It also had a concept of workspaces but this format is not recognized by VS2008. Using makefile projects also has the disadvantage that the number of projects in the solution is doubled as I have two targets to support.

    After having acquainted myself further with VSPackage Projects and MsBuild as suggested I have realized that it should be possible to modify the existing VS2008 projects by manually adding another target with its own MsBuild task that handles the external compiler. It should even be possible to add an own property page for this target. The makefile would have to be built more or less manually from scratch by the MsBuild task logic based on the properties. This is probably much too error prone to be worth the effort.

    Knowing this, it seems like the Add-in approach would be the next best thing. This is also more or less equal to adding an External Tool which is much faster but less flexible than creating an Add-in, but requires less know-how for maintainence.

    Wednesday, April 21, 2010 6:58 AM