Path: utzoo!censor!geac!torsqnt!lethe!becker!hybrid!scifi!bywater!uunet!microsoft!gregj From: gregj@microsoft.UUCP (Greg JONES) Newsgroups: comp.windows.ms.programmer Subject: Re: MS-C 286-code in Windows' real mode Summary: 8086/80286 code Message-ID: <60412@microsoft.UUCP> Date: 11 Jan 91 06:17:57 GMT References: <915@tuura.UUCP> <10289@jarthur.Claremont.EDU> Distribution: comp Organization: Microsoft Corp., Redmond WA Lines: 24 In article <10289@jarthur.Claremont.EDU>, rspangle@jarthur.Claremont.EDU (Froot Loop) writes: > In article <915@tuura.UUCP> risto@tuura.UUCP (Risto Lankinen) writes: > >The question is, how can I use the -G2 switch, but still be able to mark > >a portion of the program such, that it would be compiled to 8086/88 ? > > 2) Compile your main routine for 8086/88. But strip out all the > code but the check for 8086, and put this code in functions > that are in a module compiled for 80286. > > Admittedly, these are pretty kludgy. I'm not sure if there's a way to > compile for two different chips in one module. This isn't particularly kludgy. Just execute only 8086-compiled modules until you know you're running on a 286 (GetWinFlags will tell you what CPU you're running on). Putting the main routine (with the check) in a module compiled for 8086, and the meat of the program in other modules compiled with -G2, will work just fine. You don't need to strip out all the code but the check in order for it to work (most apps don't do tremendous amounts of work in their main routines anyway). uunet!microsoft!gregj Greg Jones, MS network development [I just happen to work here. Sheer coincidence.]