From: peuha AT cc DOT helsinki DOT fi (Esa A E Peuha) Newsgroups: comp.os.msdos.djgpp Subject: Re: Need help with DJGPP's "_dos_ds" macro Date: 21 Jan 1997 13:27:32 GMT Organization: University of Helsinki Lines: 42 Message-ID: <5c2g84$njt@oravannahka.Helsinki.FI> References: <57j1rb$p7p AT News DOT Dal DOT Ca> NNTP-Posting-Host: kruuna-ether.helsinki.fi Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Graham Howard Wile (an118 AT chebucto DOT ns DOT ca) wrote: : When I compile my test program, however, gcc gives my an error saying : the "_dos_ds" function is undefined. I've included the library "farptr.h" and : tried to compile a program with this line after having used Allegro to set : my video mode to 13h: : _farpokeb(_dos_ds, 0, 23); : It says the "_dos_ds" function isn't defined. : Also, the compiler won't let me link to the "farptr.h" library by : putting "-lfarptr" switch on. It says it can't find the file "-lfarptr". : It does this with other libraries I try to link this way too. But it will : let me link to "iostream.h" by putting a "-liostream" on the end of my : command line. Why does it do this, and not recognize the "_dos_ds" even : though I've included "farptr.h" in my code ? : Thanks very much : Graham The *.h files are not libraries. They are used to define function prototypes, constant definitions, and the like. These files are used by putting a line like `#include ´ in any source file which calls the functions or uses the values defined in XXX.h. When the source file is preprocessed, the preprocessor replaces any `#include ´ with the contents of XXX.h in its output. Libraries, on the other hand, are the `lib*.a´ files in the lib/ subdirectory. They are (usually) compressed collections of object files, which contain the code of the library functions. Libraries are used by invoking the compiler (or linker) with `-lXXX´ switch, which causes the linker to search file `libXXX.a´ for functions that should be linked within the program. Normally, there is no one-to-one correspondence between include files and libraries in standard C (this is not true in C++; the class libraries often have their own inclue files). The `_dos_ds´ macro in not defined in `farptr.h´ but in (if I remember correctly) `go32.h´; putting line `#include ´ should solve your problem. -- Esa Peuha student of mathematics at the University of Helsinki http://www.helsinki.fi/~peuha/