Linking Third Party BGI Drivers

 








  PRODUCT  :  Borland C++                            NUMBER  :  707

  VERSION  :  2.0

       OS  :  DOS

     DATE  :  September 3, 1992                        PAGE  :  1/3


    TITLE  :  Linking Third Party BGI Drivers





  /*************************************************************

  This document explains how to link third party graphics drivers

  into your program.  This example is specific to the vga256.bgi

  driver which is available on the Borland BBS (408) 439-9096.  The

  procedure is the same to link in one of the drivers that was

  shipped with your product except that  you don't need to make the

  call to installuserdriver() function which means that you also

  don't need the alwayszero() function.


     1.  Convert vga256.bgi to an object file with this command:


         BGIOBJ vga256.bgi vga256.obj _vga256_driver


     2.  Create a project file for the program that links in the

         driver.  The project should contain two items:


                 A.  test.c

                 B.  vga256.obj


     3.  Here's what test.c would look like:


  ************************************************************/


  #include <graphics.h>

  #include <stdlib.h>

  #include <stdio.h>

  #include <conio.h>


  /* function prototypes */

  int huge alwayszero(void);

  void checkerrors(void);

  void  _Cdecl vga256_driver(void);



  int main(void)

  {

     int gdriver, gmode;


     /* install the user defined driver into the system */

     gdriver = installuserdriver("vga256", alwayszero);


     /* check for any installation errors */

     checkerrors();














  PRODUCT  :  Borland C++                            NUMBER  :  707

  VERSION  :  2.0

       OS  :  DOS

     DATE  :  September 3, 1992                        PAGE  :  2/3


    TITLE  :  Linking Third Party BGI Drivers





     /* register the driver with the graphics system */

     registerbgidriver(vga256_driver);


     /* check for any installation errors */

     checkerrors();


     /* initialize graphics and local variables */

     initgraph(&gdriver, &gmode, "");


     /* check for any initialization errors */

     checkerrors();


     /* draw a line */

     setcolor(WHITE);

     line(0, 0, getmaxx(), getmaxy());


     /* clean up */

     getch();

     closegraph();

     return 0;

  }


  int huge alwayszero(void)

  {

        return 0;

  }


  /* check for and report any graphics errors */

  void checkerrors(void)

  {

     int errorcode;


     /* read result of last graphics operation */

     errorcode = graphresult();

     if (errorcode != grOk)

     {

        printf("Graphics error: %s\n", grapherrormsg(errorcode));

        printf("Press any key to halt:");

        getch();

        exit(1);

     }

  }















  PRODUCT  :  Borland C++                            NUMBER  :  707

  VERSION  :  2.0

       OS  :  DOS

     DATE  :  September 3, 1992                        PAGE  :  3/3


    TITLE  :  Linking Third Party BGI Drivers





  DISCLAIMER: You have the right to use this technical information

  subject to the terms of the No-Nonsense License Statement that

  you received with the Borland product to which this information

  pertains.














































Comments

Popular posts from this blog

BOTTOM LIVE script

Evidence supporting quantum information processing in animals

ARMIES OF CHAOS