home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fs.zip / octave / dlfcn / test / dlltest.c next >
C/C++ Source or Header  |  2000-01-15  |  603b  |  37 lines

  1. /*
  2. ** Testing the dlfcn library.
  3. ** (c) 1997, Klaus Gebhardt
  4. */
  5.  
  6. #include <stdlib.h>
  7. #include <stdio.h>
  8.  
  9. #include "../dlfcn.h"
  10.  
  11. int main (int argc, char *argv[])
  12. {
  13.   void *hmod;
  14.  
  15.   if (argc == 2)
  16.     {
  17.       printf ("\nLoading DLL: %s ...\n", argv[1]);
  18.       hmod = dlopen (argv[1], RTLD_LAZY);
  19.       if (hmod)
  20.     {
  21.       printf ("%s loaded.\n", argv[1]);
  22.       dlclose (hmod);
  23.       return 0;
  24.     }
  25.       else
  26.     {
  27.       printf ("%s not loaded.\n\n%s\n", argv[1], dlerror ());
  28.       return -1;
  29.     }
  30.     }
  31.   else
  32.     {
  33.       printf ("\nusage: test dll-filename\n");
  34.       return -1;
  35.     }
  36. }
  37.