www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/06/09:17:49

From: "George Kinney" <goober AT mail DOT net>
Subject: Re: Why doesn't it recquire DPMI server?
Newsgroups: comp.os.msdos.djgpp
References: <340B0686 DOT 5632 AT voyageur DOT ca>
Organization: The Unknown Programmers
Message-ID: <01bcb749$4f28c9a0$e18033cf@markov>
NNTP-Posting-Host: 207.51.128.225
Date: 2 Sep 97 02:28:10 GMT
Lines: 27
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

J.E. <cellis AT voyageur DOT ca> wrote in article <340B0686 DOT 5632 AT voyageur DOT ca>...
> I just wrote and compiled the following program with DJGPP:
[...]
> After exiting to DOS from Win95 (exiting to DOS, not the DOS box) I ran
> this program without first loading dpmi server, and it ran fine.  Why is
> this?  Shouldn't this executable need a dpmi server under DOS, or does
> it only need this if I make use of 32-bit functions?  Thanks in advance
> for your time and help:-)

ALL programs compiled with DJGPP require DPMI.

Now this will either be provided by the OS, or will be provided by an
extender.

When you compile a program with DJGPP, it attaches the resulting COFF
image to a stub, which is responsible for checking for DPMI availability,
and if not found, finding and loading an appropriate extender. This is
by default CWSDPMI, but you can change the stub to use other extenderd,
and can also use PMODE/DJ which is a stub with DPMI built in.

So your program checked for DPMI, didn't find it, and loaded an extender
and continued. Either that or you have another extender loaded, such as 
QDPMI.

Also, all output from DJGPP is 32bit, flat memory model. It doesn't matter
at all which functions you do or do not use, it is still 32bit.

 in
an extra `struct' each time you declare a data of type cell, then you can
insert the line
    typedef struct cell cell;
which creates a type called `cell' which is actually `struct cell'.  To
simplify things further, you can combine the typedef with the structure
definition, which now becomes:
    typedef struct cell {
     int terrain;
     BITMAP *tile;
    } cell;

Now, you can use the keyword `cell' to create a structure without the
`struct' keyword.  Allegro (I assume you have this, since you are using a
BITMAP *) uses this technique; just take a look in allegro.h.

> If I substitute class for struct I get the following as well:
> test4.c:7: parse error before `cell'
> test4.c:7: syntax error before `{'
> test4.c:10: parse error before `}'
> 
> What am I missing?  Do I need to include something to use structs and
> classes?

Again, your problem here is that GCC considers your code to be C, not C++.
If you want to be able to use classes, then you will have to tell GCC to
compile your source as C++.  The easiest way to do this is to change the
file extension to `.cc', `.cxx', or `.cpp'.

> Please help before I seriously injure the wall with my head.
> Mark.

Hope this helps you (and the wall) some.

----------------

Michael Vrable
mvrable AT aol DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019