//Sample code file: var/ndk/webBuildengine/tmp/viewable_samples/bae5da4a-b842-4667-9fdf-ef3d868564d0/nlm/impsymbl/impsymbl.c

//Warning: This code has been marked up for HTML

/************************************************************************** 
  IMPSYMBL.C 
*************************************************************************** 
  This example demonstrates the use of ImportSymbol and GetNLMHandle(). 
  The ImportSymbol function allows the programmer to test if a function 
  is available before making a call to it.  This simple example tests to  
  see if printf is available before printing a message. 
 **************************************************************************/ 
#include <nwadv.h>     /* Defines ImportSymbol() */ 
#include <nwthread.h>  /* Defines GetNLMHandle() */ 

void main(void) 
{
   int (*fp_printf) (const char*, ...); 

   fp_printf=ImportSymbol(
                         /* I- NLMHandle  */ GetNLMHandle(), 
                         /* I- symbolName */ "printf"); 

   if (fp_printf == NULL)
      return;      /* SYMBOL_NOT_FOUND */

   (*fp_printf) ("printf imported successfully."); 

   UnimportSymbol(
                 /* I- NLMHandle  */ GetNLMHandle(), 
                 /* I- symbolName */ "printf"); 

   return; 
}