Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "plplotP.h"
00025 #ifndef LTDL_WIN32
00026 #include <ltdl.h>
00027 #else
00028 #include "ltdl_win32.h"
00029 #endif
00030 #include <stdio.h>
00031 #include <signal.h>
00032 #include <stdlib.h>
00033
00034 #define SYM_LEN 300
00035 #define DRVSPEC_LEN 400
00036
00037
00038 RETSIGTYPE
00039 catch_segv( int sig )
00040 {
00041 fprintf( stderr, "libltdl error: %s\n", lt_dlerror() );
00042 exit( 1 );
00043 }
00044
00045 int
00046 main( int argc, char* argv[] )
00047 {
00048 lt_dlhandle dlhand;
00049 char sym[SYM_LEN];
00050 char * drvnam = argv[1];
00051 char drvspec[ DRVSPEC_LEN ];
00052 char ** info;
00053
00054
00055 signal( SIGSEGV, catch_segv );
00056
00057 lt_dlinit();
00058 #if defined ( LTDL_WIN32 ) || defined ( __CYGWIN__ )
00059 snprintf( drvspec, DRVSPEC_LEN, "%s", drvnam );
00060 #else
00061 snprintf( drvspec, DRVSPEC_LEN, "%s/%s", plGetDrvDir(), drvnam );
00062 #endif // LTDL_WIN32
00063 dlhand = lt_dlopenext( drvspec );
00064 if ( dlhand == NULL )
00065 {
00066 fprintf( stderr, "Could not open driver module %s\n"
00067 "libltdl error: %s\n", drvspec, lt_dlerror() );
00068 return 1;
00069 }
00070 snprintf( sym, SYM_LEN, "plD_DEVICE_INFO_%s", drvnam );
00071 info = (char **) lt_dlsym( dlhand, sym );
00072 if ( info != NULL )
00073 {
00074 printf( "%s", *info );
00075 return 0;
00076 }
00077 else
00078 {
00079 fprintf( stderr, "Could not read symbol %s in driver module %s\n"
00080 "libltdl error: %s\n", sym, drvspec, lt_dlerror() );
00081 return 1;
00082 }
00083 }