# Graphics Card Drivers: Building and Installing a Driver

The section tells you how to prepare, compile, and install your graphics driver.

- In your source code, export the `control_graphics_card()` declaration:

          __declspec(dllexport)
          int32 control_graphics_card(uint32 op, void *data);

- Tell the linker to produce a shared library. If you're using the BeIDE, go to the Settings window, pop open the Project list, click on PPC Project or x86 Project, and select "Shared Library" in the Project Type popup menu. If you're using `make`, include the`-G` option.

- Since it's loaded by the Application Server (which is, itself, a user-level app), your graphics card drivers can link against any of the BeOS libraries.

- You can name driver whatever you wish except for "stub", which is reserved for the generic driver provided by Be.

The Application Server looks for an appropriate graphics card driver in the following directories (in this order):

1. /fd/beos/system/add-ons/app_server (on a floppy)

2. /boot/home/config/add-ons/app_server

3. /boot/beos/system/add-ons/app_server

Finished, publishable drivers should be installed in #2, /boot/home/config/add-ons/app_server. Do not install in the beos/system directory. While you're working on your driver, you'll probably want to load it from one of the floppy directories (so you don't overwrite a working driver with your experimental one).

For each driver it tries to load, the Application Server prints a message to the serial port:

          Try to hire add-on name as graphic driver...

Where name is the path of the candidate driver. If the driver is rejected, the Server prints:

          name refuse the job

When it finds an acceptable driver, it prints:

          name is the new graphic driver...

If it can't find a driver, the Server looks for the generic driver called "stub".

The Be Book, in lovely HTML, for BeOS Release 3.

Copyright © 1998 Be, Inc. All rights reserved.

Last modified March 26, 1998.