eurephia_getsym.c

Go to the documentation of this file.
00001 /* eurephia_getsym.c  --  Retrieves symbols from dlopened libraries
00002  *
00003  *  GPLv2 only - Copyright (C) 2008 - 2010
00004  *               David Sommerseth <dazo@users.sourceforge.net>
00005  *
00006  *  This program is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public License
00008  *  as published by the Free Software Foundation; version 2
00009  *  of the License.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019  *
00020  */
00021 
00031 #include <stdio.h>
00032 #include <dlfcn.h>
00033 
00034 #include <eurephia_context.h>
00035 #include "eurephia_log.h"
00036 
00046 void *eGetSym(eurephiaCTX *ctx, void *dlh, const char *symnam)
00047 {
00048         void *func = NULL;
00049 
00050         if( ctx->fatal_error > 0 ) {
00051                 return NULL;
00052         }
00053 
00054         DEBUG(ctx, 30, "Locating driver function '%s'", symnam);
00055         func = dlsym(dlh, symnam);
00056         if( func == NULL ) {
00057                 eurephia_log(ctx, LOG_PANIC, 0, "Could not find needed '%s' function in eDBlink driver", symnam);
00058                 ctx->fatal_error = 1;
00059         }
00060         return func;
00061 }
00062 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines