22.02.2014 Views

with DOS/4GW? - Open Watcom

with DOS/4GW? - Open Watcom

with DOS/4GW? - Open Watcom

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>DOS</strong> Programming Guide<br />

5.5.2 Spawning Protected-Mode Applications Under Phar Lap<br />

386|<strong>DOS</strong>-Extender<br />

In the case of the Phar Lap 386|<strong>DOS</strong>-Extender, some real-mode memory must be set aside at<br />

link time for spawning the <strong>DOS</strong> extender, otherwise the spawning application will be assigned<br />

all the system memory at startup. This is done at link time by specifying the runtime minreal<br />

and runtime maxreal options, as demonstrated by the following programs.<br />

/*<br />

SPWNRPLS.C - The following program demonstrates how to<br />

spawn a Phar Lap application.<br />

Compile & Link:<br />

wcl386 /l=pharlap /"runt minr=300K,maxr=400K" spwnrpls<br />

*/<br />

#include <br />

#include <br />

void main()<br />

{<br />

int app2 exit code;<br />

puts( "Spawning a protect-mode application..."<br />

"using spawnlp() <strong>with</strong> P WAIT" );<br />

puts( "Spawning application #2..." );<br />

app2 exit code = spawnlp( P WAIT, "run386",<br />

"run386", "spwndpls", NULL );<br />

}<br />

/*<br />

printf( "Application #2 returned <strong>with</strong> exit code %d",<br />

app2 exit code );<br />

SPWNDPLS.C - Will be spawned by the SPWNRPLS program.<br />

Compile & Link: wcl386 /l=pharlap spwndpls<br />

*/<br />

#include <br />

#include <br />

void main()<br />

{<br />

puts( "\nApplication #2 spawned\n" );<br />

/* Exit <strong>with</strong> error code 59 */<br />

exit( 59 );<br />

}<br />

32 How do I spawn a protected-mode application?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!