Changeset 2459

Show
Ignore:
Timestamp:
09/06/01 10:03:21 (7 years ago)
Author:
warmerda
Message:

upgrade bridge error reporting

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bridge/bridge_test.cpp

    r1630 r2459  
    3030 * 
    3131 * $Log$ 
     32 * Revision 1.3  2001/09/06 14:03:21  warmerda 
     33 * upgrade bridge error reporting 
     34 * 
    3235 * Revision 1.2  2000/08/25 20:03:40  warmerda 
    3336 * added more entry points 
     
    5053    GDALProjDefH        hProjDef; 
    5154 
    52     if( !GDALBridgeInitialize( ".." ) ) 
     55    if( !GDALBridgeInitialize( "..", stderr ) ) 
    5356    { 
    5457        fprintf( stderr, "Unable to intiailize GDAL bridge.\n" ); 
  • trunk/bridge/gbgetsymbol.cpp

    r1716 r2459  
    3131 * 
    3232 * $Log$ 
     33 * Revision 1.3  2001/09/06 14:03:21  warmerda 
     34 * upgrade bridge error reporting 
     35 * 
    3336 * Revision 1.2  2000/09/27 13:22:07  warmerda 
    3437 * also allow for unix in check 
     
    7881    if( pSymbol == NULL ) 
    7982    { 
    80         fprintf( stderr, "GBGetSymbol(): %s", dlerror() ); 
     83        fprintf( stderr, "GBGetSymbol(): %s\n", dlerror() ); 
    8184        return NULL; 
    8285    } 
  • trunk/bridge/gdalbridge.cpp

    r2455 r2459  
    3131 * 
    3232 * $Log$ 
    33  * Revision 1.12  2001/09/06 01:54:31  warmerda 
    34  * added gcp functions 
     33 * Revision 1.13  2001/09/06 14:03:21  warmerda 
     34 * upgrade bridge error reporting 
    3535 * 
    3636 * Revision 1.10  2000/09/26 15:20:32  warmerda 
     
    6969#include <stdio.h> 
    7070#include <stdlib.h> 
     71#include <string.h> 
    7172 
    7273#ifdef _WIN32 
     
    8687#endif 
    8788 
     89#define MAX_SYMBOL      1024 
     90 
     91/************************************************************************/ 
     92/*                          GBGetSymbolCheck()                          */ 
     93/*                                                                      */ 
     94/*      Get a symbol, and on error add the missing entry point to a     */ 
     95/*      list of missing entry points.                                   */ 
     96/************************************************************************/ 
     97 
     98static void *GBGetSymbolCheck( const char *pszLibrary,  
     99                               const char *pszSymbolName, 
     100                               char **papszErrorList ) 
     101 
     102{ 
     103    void        *pReturn; 
     104     
     105    pReturn = GBGetSymbol( pszLibrary, pszSymbolName ); 
     106 
     107    if( pReturn == NULL && papszErrorList != NULL ) 
     108    { 
     109        int     i; 
     110 
     111        for( i = 0; papszErrorList[i] != NULL; i++ ) {} 
     112 
     113        if( i < MAX_SYMBOL-1 ) 
     114        { 
     115            papszErrorList[i] = strdup( pszSymbolName ); 
     116            papszErrorList[i+1] = NULL; 
     117        } 
     118    } 
     119 
     120    return pReturn; 
     121} 
    88122 
    89123/************************************************************************/ 
     
    91125/************************************************************************/ 
    92126 
    93 int GDALBridgeInitialize( const char * pszTargetDir
     127int GDALBridgeInitialize( const char * pszTargetDir, FILE *fpReportFailure
    94128 
    95129{ 
     
    97131    void        *pfnTest = NULL; 
    98132    int         iSOFile; 
    99      
     133    char        *apszFailed[MAX_SYMBOL]; 
     134     
     135/* -------------------------------------------------------------------- */ 
     136/*      Do we want to force reporting on?                               */ 
     137/* -------------------------------------------------------------------- */ 
     138    if( fpReportFailure == NULL 
     139        && (getenv("CPL_DEBUG") != NULL || getenv("GB_DEBUG") != NULL) ) 
     140    { 
     141        fpReportFailure = stderr; 
     142    } 
     143 
    100144/* -------------------------------------------------------------------- */ 
    101145/*      The first phase is to try and find the shared library.          */ 
     
    127171    } 
    128172 
     173/* -------------------------------------------------------------------- */ 
     174/*      Did we fail to even find the DLL/.so?                           */ 
     175/* -------------------------------------------------------------------- */ 
    129176    if( pfnTest == NULL ) 
     177    { 
     178 
     179        if( fpReportFailure == NULL ) 
     180            return FALSE; 
     181         
     182 
     183        fprintf( fpReportFailure,  
     184                 "GBBridgeInitialize() failed to find an suitable GDAL .DLL/.so file.\n" ); 
     185        fprintf( fpReportFailure,  
     186                 "The following filenames were searched for:\n" ); 
     187         
     188        for( iSOFile = 0; papszSOFilenames[iSOFile] != NULL; iSOFile++ ) 
     189            fprintf( fpReportFailure, "  o %s\n", papszSOFilenames[iSOFile] ); 
     190 
     191        fprintf( fpReportFailure, "\n" ); 
     192        fprintf( fpReportFailure, "The following locations were searched:\n" ); 
     193         
     194        if( pszTargetDir != NULL ) 
     195            fprintf( fpReportFailure, "  o %s\n", pszTargetDir ); 
     196         
     197        if( getenv( "GDAL_HOME" ) != NULL ) 
     198            fprintf( fpReportFailure, "  o %s\n", getenv( "GDAL_HOME" ) ); 
     199         
     200        fprintf( fpReportFailure, "  o System default locations.\n" ); 
     201        fprintf( fpReportFailure, "\n" ); 
     202 
     203        fprintf( fpReportFailure, "\n" ); 
     204#ifdef __unix__         
     205        if( getenv("LD_LIBRARY_PATH") != NULL ) 
     206        { 
     207            fprintf( fpReportFailure,  
     208                     "System default locations may be influenced by:\n" ); 
     209            fprintf( fpReportFailure,  
     210                     "LD_LIBRARY_PATH = %s\n", getenv("LD_LIBRARY_PATH") ); 
     211        } 
     212#else 
     213        if( getenv("PATH") != NULL ) 
     214        { 
     215            fprintf( fpReportFailure,  
     216                     "System default locations may be influenced by:\n" ); 
     217            fprintf( fpReportFailure,  
     218                     "PATH = %s\n", getenv("PATH") ); 
     219        } 
     220#endif         
     221         
    130222        return FALSE; 
     223    } 
    131224     
    132225/* -------------------------------------------------------------------- */ 
    133226/*      Start loading functions.                                        */ 
    134227/* -------------------------------------------------------------------- */ 
    135  
     228    apszFailed[0] = NULL; 
     229     
    136230    GDALGetDataTypeSize = (int (*)(GDALDataType)) 
    137         GBGetSymbol( szPath, "GDALGetDataTypeSize" ); 
     231        GBGetSymbolCheck( szPath, "GDALGetDataTypeSize", apszFailed ); 
    138232 
    139233    GDALAllRegister = (void (*)(void))  
    140         GBGetSymbol( szPath, "GDALAllRegister" ); 
     234        GBGetSymbolCheck( szPath, "GDALAllRegister", apszFailed ); 
    141235 
    142236    GDALCreate = (GDALDatasetH (*)(GDALDriverH, const char *, int, int, int, 
    143237                                   GDALDataType, char ** )) 
    144         GBGetSymbol( szPath, "GDALCreate" ); 
     238        GBGetSymbolCheck( szPath, "GDALCreate", apszFailed ); 
    145239 
    146240    GDALOpen = (GDALDatasetH (*)(const char *, GDALAccess)) 
    147         GBGetSymbol( szPath, "GDALOpen" ); 
     241        GBGetSymbolCheck( szPath, "GDALOpen", apszFailed ); 
    148242 
    149243    GDALGetDriverByName = (GDALDriverH (*)(const char *)) 
    150         GBGetSymbol( szPath, "GDALGetDriverByName" ); 
     244        GBGetSymbolCheck( szPath, "GDALGetDriverByName", apszFailed ); 
    151245 
    152246    GDALClose = (void (*)(GDALDatasetH)) 
    153         GBGetSymbol( szPath, "GDALClose" ); 
     247        GBGetSymbolCheck( szPath, "GDALClose", apszFailed ); 
    154248 
    155249    GDALGetRasterXSize = (int (*)(GDALDatasetH)) 
    156         GBGetSymbol( szPath, "GDALGetRasterXSize" ); 
     250        GBGetSymbolCheck( szPath, "GDALGetRasterXSize", apszFailed ); 
    157251 
    158252    GDALGetRasterYSize = (int (*)(GDALDatasetH)) 
    159         GBGetSymbol( szPath, "GDALGetRasterYSize" ); 
     253        GBGetSymbolCheck( szPath, "GDALGetRasterYSize", apszFailed ); 
    160254 
    161255    GDALGetRasterCount = (int (*)(GDALDatasetH)) 
    162         GBGetSymbol( szPath, "GDALGetRasterCount" ); 
     256        GBGetSymbolCheck( szPath, "GDALGetRasterCount", apszFailed ); 
    163257 
    164258    GDALGetRasterBand = (GDALRasterBandH (*)(GDALDatasetH, int)) 
    165         GBGetSymbol( szPath, "GDALGetRasterBand" ); 
     259        GBGetSymbolCheck( szPath, "GDALGetRasterBand", apszFailed ); 
    166260 
    167261    GDALGetProjectionRef = (const char *(*)(GDALDatasetH)) 
    168         GBGetSymbol( szPath, "GDALGetProjectionRef" ); 
     262        GBGetSymbolCheck( szPath, "GDALGetProjectionRef", apszFailed ); 
    169263 
    170264    GDALSetProjection = (CPLErr (*)(GDALDatasetH, const char *)) 
    171         GBGetSymbol( szPath, "GDALSetProjection" ); 
     265        GBGetSymbolCheck( szPath, "GDALSetProjection", apszFailed ); 
    172266 
    173267    GDALGetGeoTransform = (CPLErr (*)(GDALDatasetH, double *)) 
    174         GBGetSymbol( szPath, "GDALGetGeoTransform" ); 
     268        GBGetSymbolCheck( szPath, "GDALGetGeoTransform", apszFailed ); 
    175269 
    176270    GDALSetGeoTransform = (CPLErr (*)(GDALDatasetH, double *)) 
    177         GBGetSymbol( szPath, "GDALSetGeoTransform" ); 
     271        GBGetSymbolCheck( szPath, "GDALSetGeoTransform", apszFailed ); 
    178272 
    179273    GDALGetInternalHandle = (void *(*)(GDALDatasetH, const char *)) 
    180         GBGetSymbol( szPath, "GDALGetInternalHandle" ); 
     274        GBGetSymbolCheck( szPath, "GDALGetInternalHandle", apszFailed ); 
    181275 
    182276    GDALGetGCPCount = (int (*)(GDALDatasetH)) 
    183         GBGetSymbol( szPath, "GDALGetGCPCount" ); 
     277        GBGetSymbolCheck( szPath, "GDALGetGCPCount", apszFailed ); 
    184278 
    185279    GDALGetGCPProjection = (const char *(*)(GDALDatasetH)) 
    186         GBGetSymbol( szPath, "GDALGetGCPProjection" ); 
     280        GBGetSymbolCheck( szPath, "GDALGetGCPProjection", apszFailed ); 
    187281 
    188282    GDALGetGCPs = (const GDAL_GCP *(*)(GDALDatasetH)) 
    189         GBGetSymbol( szPath, "GDALGetGCPs" ); 
     283        GBGetSymbolCheck( szPath, "GDALGetGCPs", apszFailed ); 
    190284 
    191285    GDALGetRasterDataType = (GDALDataType (*)(GDALRasterBandH)) 
    192         GBGetSymbol( szPath, "GDALGetRasterDataType" ); 
     286        GBGetSymbolCheck( szPath, "GDALGetRasterDataType", apszFailed ); 
    193287 
    194288    GDALGetRasterBandXSize = (int (*)(GDALRasterBandH)) 
    195         GBGetSymbol( szPath, "GDALGetRasterBandXSize" ); 
     289        GBGetSymbolCheck( szPath, "GDALGetRasterBandXSize", apszFailed ); 
    196290 
    197291    GDALGetRasterBandYSize = (int (*)(GDALRasterBandH)) 
    198         GBGetSymbol( szPath, "GDALGetRasterBandYSize" ); 
     292        GBGetSymbolCheck( szPath, "GDALGetRasterBandYSize", apszFailed ); 
    199293 
    200294    GDALGetBlockSize = (void (*)(GDALRasterBandH, int *, int *)) 
    201         GBGetSymbol( szPath, "GDALGetBlockSize" ); 
     295        GBGetSymbolCheck( szPath, "GDALGetBlockSize", apszFailed ); 
    202296 
    203297    GDALRasterIO = (CPLErr (*)(GDALRasterBandH, GDALRWFlag, int, int, int, int, 
    204298                               void *, int, int, GDALDataType, int, int )) 
    205         GBGetSymbol( szPath, "GDALRasterIO" ); 
     299        GBGetSymbolCheck( szPath, "GDALRasterIO", apszFailed ); 
    206300 
    207301    GDALReadBlock = (CPLErr (*)(GDALRasterBandH, int, int, void *)) 
    208         GBGetSymbol( szPath, "GDALReadBlock" ); 
     302        GBGetSymbolCheck( szPath, "GDALReadBlock", apszFailed ); 
    209303     
    210304    GDALWriteBlock = (CPLErr (*)(GDALRasterBandH, int, int, void *)) 
    211         GBGetSymbol( szPath, "GDALWriteBlock" ); 
     305        GBGetSymbolCheck( szPath, "GDALWriteBlock", apszFailed ); 
    212306 
    213307    GDALGetOverviewCount = (int (*)(GDALRasterBandH)) 
    214         GBGetSymbol( szPath, "GDALGetOverviewCount" ); 
     308        GBGetSymbolCheck( szPath, "GDALGetOverviewCount", apszFailed ); 
    215309 
    216310    GDALGetOverview = (GDALRasterBandH (*)(GDALRasterBandH, int)) 
    217         GBGetSymbol( szPath, "GDALGetOverview" ); 
     311        GBGetSymbolCheck( szPath, "GDALGetOverview", apszFailed ); 
    218312 
    219313    GDALGetRasterNoDataValue = (double (*)(GDALRasterBandH, int*)) 
    220         GBGetSymbol( szPath, "GDALGetRasterNoDataValue" ); 
     314        GBGetSymbolCheck( szPath, "GDALGetRasterNoDataValue", apszFailed ); 
    221315 
    222316    GDALSetRasterNoDataValue = (CPLErr (*)(GDALRasterBandH, double)) 
    223         GBGetSymbol( szPath, "GDALSetRasterNoDataValue" ); 
     317        GBGetSymbolCheck( szPath, "GDALSetRasterNoDataValue", apszFailed ); 
    224318 
    225319    GDALGetRasterColorInterpretation = (GDALColorInterp (*)(GDALRasterBandH)) 
    226         GBGetSymbol( szPath, "GDALGetRasterColorInterpretation" ); 
     320        GBGetSymbolCheck( szPath, "GDALGetRasterColorInterpretation", apszFailed ); 
    227321 
    228322    GDALGetColorInterpretationName = (const char *(*)(GDALColorInterp)) 
    229         GBGetSymbol( szPath, "GDALGetColorInterpretationName" ); 
     323        GBGetSymbolCheck( szPath, "GDALGetColorInterpretationName", apszFailed ); 
    230324 
    231325    GDALGetRasterColorTable = (GDALColorTableH (*)(GDALRasterBandH)) 
    232         GBGetSymbol( szPath, "GDALGetRasterColorTable" ); 
     326        GBGetSymbolCheck( szPath, "GDALGetRasterColorTable", apszFailed ); 
    233327 
    234328    GDALCreateProjDef = (GDALProjDefH (*)(const char *)) 
    235         GBGetSymbol( szPath, "GDALCreateProjDef" ); 
     329        GBGetSymbolCheck( szPath, "GDALCreateProjDef", apszFailed ); 
    236330 
    237331    GDALReprojectToLongLat = (CPLErr (*)(GDALProjDefH, double *, double *)) 
    238         GBGetSymbol( szPath, "GDALReprojectToLongLat" ); 
     332        GBGetSymbolCheck( szPath, "GDALReprojectToLongLat", apszFailed ); 
    239333     
    240334    GDALReprojectFromLongLat = (CPLErr (*)(GDALProjDefH, double *, double *)) 
    241         GBGetSymbol( szPath, "GDALReprojectFromLongLat" ); 
     335        GBGetSymbolCheck( szPath, "GDALReprojectFromLongLat", apszFailed ); 
    242336 
    243337    GDALDestroyProjDef = (void (*)(GDALProjDefH)) 
    244         GBGetSymbol( szPath, "GDALDestroyProjDef" ); 
     338        GBGetSymbolCheck( szPath, "GDALDestroyProjDef", apszFailed ); 
    245339 
    246340    GDALDecToDMS = (const char *(*)(double, const char *, int )) 
    247         GBGetSymbol( szPath, "GDALDecToDMS" ); 
     341        GBGetSymbolCheck( szPath, "GDALDecToDMS", apszFailed ); 
    248342 
    249343    GDALGetPaletteInterpretation = (GDALPaletteInterp (*)(GDALColorTableH)) 
    250         GBGetSymbol( szPath, "GDALGetPaletteInterpretation" ); 
     344        GBGetSymbolCheck( szPath, "GDALGetPaletteInterpretation", apszFailed ); 
    251345 
    252346    GDALGetPaletteInterpretationName = (const char *(*)(GDALPaletteInterp)) 
    253         GBGetSymbol( szPath, "GDALGetPaletteInterpretationName" ); 
     347        GBGetSymbolCheck( szPath, "GDALGetPaletteInterpretationName", apszFailed ); 
    254348 
    255349    GDALGetColorEntryCount = (int (*)(GDALColorTableH)) 
    256         GBGetSymbol( szPath, "GDALGetColorEntryCount" ); 
     350        GBGetSymbolCheck( szPath, "GDALGetColorEntryCount", apszFailed ); 
    257351 
    258352    GDALGetColorEntry = (const GDALColorEntry *(*)(GDALColorTableH,int)) 
    259         GBGetSymbol( szPath, "GDALGetColorEntry" ); 
     353        GBGetSymbolCheck( szPath, "GDALGetColorEntry", apszFailed ); 
    260354 
    261355    GDALGetColorEntryAsRGB = (int (*)(GDALColorTableH,int, 
    262356                                      GDALColorEntry*)) 
    263         GBGetSymbol( szPath, "GDALGetColorEntryAsRGB" ); 
     357        GBGetSymbolCheck( szPath, "GDALGetColorEntryAsRGB", apszFailed ); 
    264358     
    265359    GDALSetColorEntry = (void (*)(GDALColorTableH, int, const GDALColorEntry*)) 
    266         GBGetSymbol( szPath, "GDALSetColorEntry" ); 
     360        GBGetSymbolCheck( szPath, "GDALSetColorEntry", apszFailed ); 
    267361 
    268362/* -------------------------------------------------------------------- */ 
     
    270364/* -------------------------------------------------------------------- */ 
    271365    OSRNewSpatialReference = (OGRSpatialReferenceH (*)( const char * )) 
    272         GBGetSymbol( szPath, "OSRNewSpatialReference" ); 
     366        GBGetSymbolCheck( szPath, "OSRNewSpatialReference", apszFailed ); 
    273367 
    274368    OSRCloneGeogCS = (OGRSpatialReferenceH (*)(OGRSpatialReferenceH)) 
    275         GBGetSymbol( szPath, "OSRCloneGeogCS" ); 
     369        GBGetSymbolCheck( szPath, "OSRCloneGeogCS", apszFailed ); 
    276370 
    277371    OSRDestroySpatialReference = (void (*)(OGRSpatialReferenceH)) 
    278         GBGetSymbol( szPath, "OSRDestroySpatialReference" ); 
     372        GBGetSymbolCheck( szPath, "OSRDestroySpatialReference", apszFailed ); 
    279373 
    280374    OSRReference = (int (*)(OGRSpatialReferenceH)) 
    281         GBGetSymbol( szPath, "OSRReference" ); 
     375        GBGetSymbolCheck( szPath, "OSRReference", apszFailed ); 
    282376 
    283377    OSRDereference = (int (*)(OGRSpatialReferenceH)) 
    284         GBGetSymbol( szPath, "OSRDereference" ); 
     378        GBGetSymbolCheck( szPath, "OSRDereference", apszFailed ); 
    285379 
    286380    OSRImportFromEPSG = (OGRErr (*)(OGRSpatialReferenceH,int)) 
    287         GBGetSymbol( szPath, "OSRImportFromEPSG" ); 
     381        GBGetSymbolCheck( szPath, "OSRImportFromEPSG", apszFailed ); 
    288382 
    289383    OSRImportFromWkt = (OGRErr (*)(OGRSpatialReferenceH,char **)) 
    290         GBGetSymbol( szPath, "OSRImportFromWkt" ); 
     384        GBGetSymbolCheck( szPath, "OSRImportFromWkt", apszFailed ); 
    291385 
    292386    OSRImportFromProj4 = (OGRErr (*)(OGRSpatialReferenceH,const char *)) 
    293         GBGetSymbol( szPath, "OSRImportFromProj4" ); 
     387        GBGetSymbolCheck( szPath, "OSRImportFromProj4", apszFailed ); 
    294388 
    295389    OSRExportToWkt = (OGRErr (*)(OGRSpatialReferenceH, char **)) 
    296         GBGetSymbol( szPath, "OSRExportToWkt" ); 
     390        GBGetSymbolCheck( szPath, "OSRExportToWkt", apszFailed ); 
    297391     
    298392    OSRExportToPrettyWkt = (OGRErr (*)(OGRSpatialReferenceH, char **, int)) 
    299         GBGetSymbol( szPath, "OSRExportToPrettyWkt" ); 
     393        GBGetSymbolCheck( szPath, "OSRExportToPrettyWkt", apszFailed ); 
    300394     
    301395    OSRExportToProj4 = (OGRErr (*)(OGRSpatialReferenceH, char **)) 
    302         GBGetSymbol( szPath, "OSRExportToProj4" ); 
     396        GBGetSymbolCheck( szPath, "OSRExportToProj4", apszFailed ); 
    303397     
    304398    OSRSetAttrValue = (OGRErr (*)(OGRSpatialReferenceH, const char *,  
    305399                                  const char *)) 
    306         GBGetSymbol( szPath, "OSRSetAttrValue" ); 
     400        GBGetSymbolCheck( szPath, "OSRSetAttrValue", apszFailed ); 
    307401     
    308402    OSRGetAttrValue = (const char *(*)(OGRSpatialReferenceH, const char *,int)) 
    309         GBGetSymbol( szPath, "OSRGetAttrValue" ); 
     403        GBGetSymbolCheck( szPath, "OSRGetAttrValue", apszFailed ); 
    310404     
    311405    OSRSetLinearUnits = (OGRErr (*)(OGRSpatialReferenceH, const char *,double)) 
    312         GBGetSymbol( szPath, "OSRSetLinearUnits" ); 
     406        GBGetSymbolCheck( szPath, "OSRSetLinearUnits", apszFailed ); 
    313407     
    314408    OSRGetLinearUnits = (double (*)(OGRSpatialReferenceH, char **)) 
    315         GBGetSymbol( szPath, "OSRGetLinearUnits" ); 
     409        GBGetSymbolCheck( szPath, "OSRGetLinearUnits", apszFailed ); 
    316410     
    317411    OSRIsGeographic = (int (*)(OGRSpatialReferenceH)) 
    318         GBGetSymbol( szPath, "OSRIsGeographic" ); 
     412        GBGetSymbolCheck( szPath, "OSRIsGeographic", apszFailed ); 
    319413     
    320414    OSRIsProjected = (int (*)(OGRSpatialReferenceH)) 
    321         GBGetSymbol( szPath, "OSRIsProjected" ); 
     415        GBGetSymbolCheck( szPath, "OSRIsProjected", apszFailed ); 
    322416     
    323417    OSRIsSameGeogCS = (int (*)(OGRSpatialReferenceH,OGRSpatialReferenceH)) 
    324         GBGetSymbol( szPath, "OSRIsSameGeogCS" ); 
     418        GBGetSymbolCheck( szPath, "OSRIsSameGeogCS", apszFailed ); 
    325419     
    326420    OSRIsSame = (int (*)(OGRSpatialReferenceH,OGRSpatialReferenceH)) 
    327         GBGetSymbol( szPath, "OSRIsSame" ); 
     421        GBGetSymbolCheck( szPath, "OSRIsSame", apszFailed ); 
    328422     
    329423    OSRSetProjCS = (OGRErr (*)(OGRSpatialReferenceH,const char*)) 
    330         GBGetSymbol( szPath, "OSRSetProjCS" ); 
     424        GBGetSymbolCheck( szPath, "OSRSetProjCS", apszFailed ); 
    331425 
    332426    OSRSetWellKnownGeogCS = (OGRErr (*)(OGRSpatialReferenceH, const char *)) 
    333         GBGetSymbol( szPath, "OSRSetWellKnownGeogCS" ); 
     427        GBGetSymbolCheck( szPath, "OSRSetWellKnownGeogCS", apszFailed ); 
    334428 
    335429    OSRSetGeogCS = (OGRErr (*)( OGRSpatialReferenceH hSRS, 
     
    342436                                const char * pszUnits /* = NULL */, 
    343437                                double dfConvertToRadians /* = 0.0 */ )) 
    344         GBGetSymbol( szPath, "OSRSetGeogCS" ); 
     438        GBGetSymbolCheck( szPath, "OSRSetGeogCS", apszFailed ); 
    345439         
    346440    OSRGetSemiMajor = (double (*)(OGRSpatialReferenceH, OGRErr *)) 
    347         GBGetSymbol( szPath, "OSRGetSemiMajor" ); 
     441        GBGetSymbolCheck( szPath, "OSRGetSemiMajor", apszFailed ); 
    348442 
    349443    OSRGetSemiMinor = (double (*)(OGRSpatialReferenceH, OGRErr *)) 
    350         GBGetSymbol( szPath, "OSRGetSemiMinor" ); 
     444        GBGetSymbolCheck( szPath, "OSRGetSemiMinor", apszFailed ); 
    351445 
    352446    OSRGetInvFlattening = (double (*)(OGRSpatialReferenceH, OGRErr *)) 
    353         GBGetSymbol( szPath, "OSRGetInvFlattening" ); 
     447        GBGetSymbolCheck( szPath, "OSRGetInvFlattening", apszFailed ); 
    354448 
    355449    OSRSetAuthority = (OGRErr (*)(OGRSpatialReferenceH, const char *,  
    356450                                  const char *, int)) 
    357         GBGetSymbol( szPath, "OSRSetAuthority" ); 
     451        GBGetSymbolCheck( szPath, "OSRSetAuthority", apszFailed ); 
    358452 
    359453    OSRSetProjParm = (OGRErr (*)(OGRSpatialReferenceH, const char *, double)) 
    360         GBGetSymbol( szPath, "OSRSetProjParm" ); 
     454        GBGetSymbolCheck( szPath, "OSRSetProjParm", apszFailed ); 
    361455 
    362456    OSRGetProjParm = (double (*)(OGRSpatialReferenceH, const char *,  
    363457                                 double, OGRErr *)) 
    364         GBGetSymbol( szPath, "OSRGetProjParm" ); 
     458        GBGetSymbolCheck( szPath, "OSRGetProjParm", apszFailed ); 
    365459 
    366460    OSRSetUTM = (OGRErr (*)(OGRSpatialReferenceH, int, int)) 
    367         GBGetSymbol( szPath, "OSRSetUTM" ); 
     461        GBGetSymbolCheck( szPath, "OSRSetUTM", apszFailed ); 
    368462 
    369463    OSRGetUTMZone = (int (*)(OGRSpatialReferenceH, int *)) 
    370         GBGetSymbol( szPath, "OSRGetUTMZone" ); 
    371  
    372     return TRUE; 
     464        GBGetSymbolCheck( szPath, "OSRGetUTMZone", apszFailed ); 
     465 
     466/* -------------------------------------------------------------------- */ 
     467/*      Did we fail to find any entry points?                           */ 
     468/* -------------------------------------------------------------------- */ 
     469    if( apszFailed[0] != NULL && fpReportFailure != NULL ) 
     470    { 
     471        int     iError; 
     472         
     473        fprintf( fpReportFailure,  
     474                 "While a GDAL .DLL/.so was found at `%s'\n" 
     475                 "it appears to be missing the following entry points.\n" 
     476                 "Consider upgrading to a more recent GDAL library.\n", 
     477                 szPath ); 
     478         
     479        for( iError = 0; apszFailed[iError] != NULL; iError++ ) 
     480        { 
     481            fprintf( fpReportFailure, "  o %s\n", apszFailed[iError] ); 
     482            free( apszFailed[iError] ); 
     483        } 
     484    } 
     485 
     486    return apszFailed[0] == NULL; 
    373487} 
    374488 
     489 
  • trunk/bridge/gdalbridge.h

    r2455 r2459  
    3131 * 
    3232 * $Log$ 
    33  * Revision 1.10  2001/09/06 01:54:31  warmerda 
    34  * added gcp functions 
     33 * Revision 1.11  2001/09/06 14:03:21  warmerda 
     34 * upgrade bridge error reporting 
    3535 * 
    3636 * Revision 1.8  2000/11/09 16:25:30  warmerda 
     
    6363extern "C" { 
    6464#endif 
     65 
     66#include <stdio.h> 
    6567     
    6668/* ==================================================================== */ 
     
    660662/*      returns TRUE if it succeeds, or FALSE otherwise.                */ 
    661663/* -------------------------------------------------------------------- */ 
    662 int     GDALBridgeInitialize( const char * ); 
     664int     GDALBridgeInitialize( const char *, FILE * ); 
    663665void    *GBGetSymbol( const char *, const char * ); 
    664666