Chapter 2:
Initialization and Termination Functions
 

The initialization and termination functions are only executed once in your application.

 

InitTDGLIB(); Initialize the PGSDK library

 

FiniTDGLIB(); Finished Using PGSDK library

   

InitTDGLIB()

 

This function initializes the graphics library. Initializing the library is done only once in your application program. Initialization can occur anywhere in your application but must be the first API call made to the library.

Syntax:

INT16 PUBLIC
InitTDGLIB (
     void
);

Input:

None

Return:

INT16: Zero = Initialization Successful, Non-Zero = Initialization Failed

Example:

// Standard initialization
int nStatus;
if ( nStatus = InitTDGLIB() )
{
     AfxMessageBox("Init Library failed");
     return(FALSE);
}

Also See:

FiniTDGLIB()

FiniTDGLIB()

 

This function closes the graphics library and frees all memory associated with it. It should be called only one time at the very end of any program that uses the library.

Syntax:

INT16 PUBLIC
FiniTDGLIB (
     void
);

Input:

None

Return:

Zero

Notes:

Both the draw environment pointer and the graph pointer (allocated by AllocDrawEnvPtr() and AllocGraphPtr()) must be released before this function is called! See Sample below.

Example:

/* Free Draw Environment Memory */
FreeDrawEnvPtr ( gpDrawEnv );
/* Free Graph Memory */     
FreeGraphPtr ( gpDraw );
/* Close the Graphics Library */
FiniTDGLIB();     

Also See:

FreeDrawEnvPtr(), FreeGraphPtr(), AllocDrawEnvPtr(), AllocGraphPtr()