
__INIT(4)        DEVICES AND NETWORK INTERFACES         __INIT(4)

NAME
     __INIT - function added to objects to handle  initialization
     of variables.

SYNOPSIS
     __INIT();

DESCRIPTION
     When the driver compiles an object  that  contains  variable
     declarations  that initialize the variables, then the driver
     inserts a function named __INIT() in the compiled object  in
     which  the  initializations  are performed.  For example, in
     the following object:

       int x = 3;

       void
       create()
       {
          write(x + "\n");
       }

     the driver would translate it into  the  following  internal
     form before compiling the object:

       int x;

       __INIT()
       {
          x = 3;
       }

       void
       create()
       {
          write(x + "\n");
       }

     If you add a function named __INIT() to one of your objects,
     then  the driver will call it at object-load-time just as if
     the driver had inserted the function on its own.   Be  aware
     that  if  you  do this and the driver needs to add __INIT in
     order to initialize variables, then there  will  be  a  con-
     flict.

Sun Release 4.1           Last change:                          1

