Article View: comp.lang.pascal.borland
Article #9Linking bgi device drivers into xe files.
From: Gregary John Boyles
Date: Wed, 15 Nov 1995 04:24
Date: Wed, 15 Nov 1995 04:24
104 lines
3297 bytes
3297 bytes
The idea is to place the drivers in grphdrvr object file so that they can be
linked into the application and you do not have to supply the seperate driver
files. How do you do it?
grphdrvr.cpp
------------
#include <graphics.h>
#include <stdio.h>
#include <process.h>
extern void attdriver();
extern void cgadriver();
extern void egavgadriver();
extern void hercdriver();
extern void pc3270driver();
extern void ibm8514driver();
extern void svga256driver();
void reporterror(const char *string)
{
printf("%s : %s",string,grapherrormsg(graphresult()));
exit(1);
}
int initdrivers()
{
if (registerbgidriver(&attdriver)<0)
reporterror("ATT");
if (registerbgidriver(&cgadriver)<0)
reporterror("CGA");
if (registerbgidriver(&egavgadriver)<0)
reporterror("EGA-VGA");
if (registerbgidriver(&hercdriver)<0)
reporterror("HERCULES");
if (registerbgidriver(&pc3270driver)<0)
reporterror("PC-3270");
if (registerbgidriver(&ibm8514driver)<0)
reporterror("IBM-8514");
if (registerbgidriver(&svga256driver)<0)
reporterror("SVGA-256");
return(1);
}
int initialized=initdrivers();
------------------------------------------------------------------------------
Compiles O.K.
tlink /x /Tde /Ld:\bc45\lib grphdrvr svga256 egavga cga att herc ibm8514
pc3270,,,graphics.lib cl.lib
where the graphics driver object files are produced from bgiobj.exe
Turbo Link Version 7.00 Copyright (c) 1987, 1994 Borland International
Error: Segment _TEXT exceeds 64K
EQUIVALENT TURBO PASCAL UNIT
----------------------------
unit grphdrvr;
interface
uses graph;
implementation
procedure attdriverproc;external;{$L att.obj}
procedure cgadriverproc;external;{$L cga.obj}
procedure egavgadriverproc;external;{$L egavga.obj}
procedure hercdriverproc;external;{$L herc.obj}
procedure pc3270driverproc;external;{$L pc3270.obj}
procedure ibm8514driverproc;external;{$L ibm8514.obj}
procedure svga256driverproc;external;{$L svga256.obj}
procedure reporterror(s:string);
begin
writeln;
writeln(s,' : ',grapherrormsg(graphresult));
halt(1);
end;{procedure}
begin
if registerbgidriver(@attdriverproc)<0 then
reporterror('ATT');
if registerbgidriver(@cgadriverproc)<0 then
reporterror('CGA');
if registerbgidriver(@egavgadriverproc)<0 then
reporterror('EGA-VGA');
if registerbgidriver(@hercdriverproc)<0 then
reporterror('HERCULES');
if registerbgidriver(@pc3270driverproc)<0 then
reporterror('PC-3270');
if registerbgidriver(@ibm8514driverproc)<0 then
reporterror('IBM-8514');
if registerbgidriver(@svga256driverproc)<0 then
reporterror('SVGA-256');
end.
Technical Details
Message-ID:
<48bq2f$jkn@lugb.latrobe.edu.au>Path:
arc1-ca.pugleaf.net!lugb.latrobe.edu.au!lux!cs102238Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!lugb.latrobe.edu.au!lux!cs102238 From: cs102238@lux.latrobe.edu.au (Gregary John Boyles ) Newsgroups: comp.lang.pascal.borland,comp.lang.c,comp.lang.c++ Subject: Linking bgi device drivers into xe files. Date: 15 Nov 1995 04:24:47 GMT Organization: La Trobe University Distribution: world Message-ID: <48bq2f$jkn@lugb.latrobe.edu.au> NNTP-Posting-Host: lux.latrobe.edu.au