File: gdalbridge.cpp

package info (click to toggle)
gdal 1.3.2-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 37,640 kB
  • ctags: 38,948
  • sloc: cpp: 303,891; ansic: 136,081; sh: 8,216; python: 6,215; java: 2,991; perl: 1,532; makefile: 674; xml: 185; php: 24
file content (555 lines) | stat: -rw-r--r-- 22,936 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
/******************************************************************************
 * $Id: gdalbridge.cpp,v 1.15 2003/07/17 03:33:15 sperkins Exp $
 *
 * Project:  GDAL Bridge 
 * Purpose:  Implementation of GDALBridgeInitialize()
 * Author:   Frank Warmerdam, warmerda@home.com
 *
 * Adapted from cplgetsymbol.cpp.
 *
 ******************************************************************************
 * Copyright (c) 1999, Frank Warmerdam
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 ******************************************************************************
 *
 * $Log: gdalbridge.cpp,v $
 * Revision 1.15  2003/07/17 03:33:15  sperkins
 * added GDALFILLRaster()
 *
 * Revision 1.14  2001/11/18 00:48:24  warmerda
 * substantial upgrade
 *
 * Revision 1.13  2001/09/06 14:03:21  warmerda
 * upgrade bridge error reporting
 *
 * Revision 1.10  2000/09/26 15:20:32  warmerda
 * added GDALGetRasterBand{X,Y}Size
 *
 * Revision 1.9  2000/09/01 19:12:09  warmerda
 * fixed const mismatch
 *
 * Revision 1.8  2000/08/28 20:16:14  warmerda
 * added lots of OGRSpatialReference stuff
 *
 * Revision 1.7  2000/08/25 20:03:40  warmerda
 * added more entry points
 *
 * Revision 1.6  1999/09/17 03:18:08  warmerda
 * change to search for a list of GDAL .so/.dll files
 *
 * Revision 1.5  1999/05/07 14:08:49  warmerda
 * change .so name
 *
 * Revision 1.4  1999/04/22 13:35:11  warmerda
 * Fixed copyright header.
 *
 */

/* ==================================================================== */
/*      We #define GDAL_ENTRY to nothing so that when the include 	*/
/*	file is include the real definition of the function pointer     */
/*      variables will occur in this files object file.                 */
/* ==================================================================== */

#define GDAL_ENTRY
#define GDAL_NULL	= NULL

#include "gdalbridge.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef _WIN32
#define PATH_SEP '\\'
static const char *papszSOFilenames[] = {
	 "gdal11.dll"
	,"gdal.1.0.dll"
	, NULL };
#else
#define PATH_SEP '/'
static const char *papszSOFilenames[] = {
	 "libgdal.1.1.so"
	,"gdal.1.0.so"
	,"gdal.so.1.0"
	,"libgdal.so.1"
	, NULL };
#endif

#define MAX_SYMBOL	1024

/************************************************************************/
/*                          GBGetSymbolCheck()                          */
/*                                                                      */
/*      Get a symbol, and on error add the missing entry point to a     */
/*      list of missing entry points.                                   */
/************************************************************************/

static void *GBGetSymbolCheck( const char *pszLibrary, 
                               const char *pszSymbolName,
                               char **papszErrorList )

{
    void	*pReturn;
    
    pReturn = GBGetSymbol( pszLibrary, pszSymbolName );

    if( pReturn == NULL && papszErrorList != NULL )
    {
        int	i;

        for( i = 0; papszErrorList[i] != NULL; i++ ) {}

        if( i < MAX_SYMBOL-1 )
        {
            papszErrorList[i] = strdup( pszSymbolName );
            papszErrorList[i+1] = NULL;
        }
    }

    return pReturn;
}

/************************************************************************/
/*                        GDALBridgeInitialize()                        */
/************************************************************************/

int GDALBridgeInitialize( const char * pszTargetDir, FILE *fpReportFailure )

{
    char	szPath[2048];
    void	*pfnTest = NULL;
    int		iSOFile;
    char        *apszFailed[MAX_SYMBOL];
    
/* -------------------------------------------------------------------- */
/*      Do we want to force reporting on?                               */
/* -------------------------------------------------------------------- */
    if( fpReportFailure == NULL
        && (getenv("CPL_DEBUG") != NULL || getenv("GB_DEBUG") != NULL) )
    {
        fpReportFailure = stderr;
    }

/* -------------------------------------------------------------------- */
/*      The first phase is to try and find the shared library.          */
/* -------------------------------------------------------------------- */
    for( iSOFile = 0;
         papszSOFilenames[iSOFile] != NULL && pfnTest == NULL;
         iSOFile++ )
    {
        if( pszTargetDir != NULL )
        {
            sprintf( szPath, "%s%c%s",
                     pszTargetDir, PATH_SEP, papszSOFilenames[iSOFile] );
            pfnTest = GBGetSymbol( szPath, "GDALOpen" );
        }

        if( pfnTest == NULL && getenv( "GDAL_HOME" ) != NULL )
        {
            sprintf( szPath,
                     "%s%c%s", getenv("GDAL_HOME"),
                     PATH_SEP, papszSOFilenames[iSOFile] );
            pfnTest = GBGetSymbol( szPath, "GDALOpen" );
        }

        if( pfnTest == NULL )
        {
            sprintf( szPath, papszSOFilenames[iSOFile] );
            pfnTest = GBGetSymbol( szPath, "GDALOpen" );
        }
    }

/* -------------------------------------------------------------------- */
/*      Did we fail to even find the DLL/.so?                           */
/* -------------------------------------------------------------------- */
    if( pfnTest == NULL )
    {

        if( fpReportFailure == NULL )
            return FALSE;
        

        fprintf( fpReportFailure, 
                 "GBBridgeInitialize() failed to find an suitable GDAL .DLL/.so file.\n" );
        fprintf( fpReportFailure, 
                 "The following filenames were searched for:\n" );
        
        for( iSOFile = 0; papszSOFilenames[iSOFile] != NULL; iSOFile++ )
            fprintf( fpReportFailure, "  o %s\n", papszSOFilenames[iSOFile] );

        fprintf( fpReportFailure, "\n" );
        fprintf( fpReportFailure, "The following locations were searched:\n" );
        
        if( pszTargetDir != NULL )
            fprintf( fpReportFailure, "  o %s\n", pszTargetDir );
        
        if( getenv( "GDAL_HOME" ) != NULL )
            fprintf( fpReportFailure, "  o %s\n", getenv( "GDAL_HOME" ) );
        
        fprintf( fpReportFailure, "  o System default locations.\n" );
        fprintf( fpReportFailure, "\n" );

        fprintf( fpReportFailure, "\n" );
#ifdef __unix__        
        if( getenv("LD_LIBRARY_PATH") != NULL )
        {
            fprintf( fpReportFailure, 
                     "System default locations may be influenced by:\n" );
            fprintf( fpReportFailure, 
                     "LD_LIBRARY_PATH = %s\n", getenv("LD_LIBRARY_PATH") );
        }
#else
        if( getenv("PATH") != NULL )
        {
            fprintf( fpReportFailure, 
                     "System default locations may be influenced by:\n" );
            fprintf( fpReportFailure, 
                     "PATH = %s\n", getenv("PATH") );
        }
#endif        
        
        return FALSE;
    }
    
/* -------------------------------------------------------------------- */
/*      Start loading functions.                                        */
/* -------------------------------------------------------------------- */
    apszFailed[0] = NULL;
    
    GDALGetDataTypeSize = (int (*)(GDALDataType))
        GBGetSymbolCheck( szPath, "GDALGetDataTypeSize", apszFailed );

    GDALAllRegister = (void (*)(void)) 
        GBGetSymbolCheck( szPath, "GDALAllRegister", apszFailed );

    GDALCreate = (GDALDatasetH (*)(GDALDriverH, const char *, int, int, int,
                                   GDALDataType, char ** ))
        GBGetSymbolCheck( szPath, "GDALCreate", apszFailed );

    GDALOpen = (GDALDatasetH (*)(const char *, GDALAccess))
        GBGetSymbolCheck( szPath, "GDALOpen", apszFailed );

    GDALGetDriverByName = (GDALDriverH (*)(const char *))
        GBGetSymbolCheck( szPath, "GDALGetDriverByName", apszFailed );

    GDALGetDriverShortName = (const char *(*)(GDALDriverH))
        GBGetSymbolCheck( szPath, "GDALGetDriverShortName", apszFailed );

    GDALGetDriverLongName = (const char *(*)(GDALDriverH))
        GBGetSymbolCheck( szPath, "GDALGetDriverLongName", apszFailed );

    GDALGetDatasetDriver = (GDALDriverH (*)(GDALDatasetH))
        GBGetSymbolCheck( szPath, "GDALGetDatasetDriver", apszFailed );

    GDALClose = (void (*)(GDALDatasetH))
        GBGetSymbolCheck( szPath, "GDALClose", apszFailed );

    GDALGetRasterXSize = (int (*)(GDALDatasetH))
        GBGetSymbolCheck( szPath, "GDALGetRasterXSize", apszFailed );

    GDALGetRasterYSize = (int (*)(GDALDatasetH))
        GBGetSymbolCheck( szPath, "GDALGetRasterYSize", apszFailed );

    GDALGetRasterCount = (int (*)(GDALDatasetH))
        GBGetSymbolCheck( szPath, "GDALGetRasterCount", apszFailed );

    GDALGetRasterBand = (GDALRasterBandH (*)(GDALDatasetH, int))
        GBGetSymbolCheck( szPath, "GDALGetRasterBand", apszFailed );

    GDALGetProjectionRef = (const char *(*)(GDALDatasetH))
        GBGetSymbolCheck( szPath, "GDALGetProjectionRef", apszFailed );

    GDALSetProjection = (CPLErr (*)(GDALDatasetH, const char *))
        GBGetSymbolCheck( szPath, "GDALSetProjection", apszFailed );

    GDALGetGeoTransform = (CPLErr (*)(GDALDatasetH, double *))
        GBGetSymbolCheck( szPath, "GDALGetGeoTransform", apszFailed );

    GDALSetGeoTransform = (CPLErr (*)(GDALDatasetH, double *))
        GBGetSymbolCheck( szPath, "GDALSetGeoTransform", apszFailed );

    GDALGetInternalHandle = (void *(*)(GDALDatasetH, const char *))
        GBGetSymbolCheck( szPath, "GDALGetInternalHandle", apszFailed );

    GDALGetGCPCount = (int (*)(GDALDatasetH))
        GBGetSymbolCheck( szPath, "GDALGetGCPCount", apszFailed );

    GDALGetGCPProjection = (const char *(*)(GDALDatasetH))
        GBGetSymbolCheck( szPath, "GDALGetGCPProjection", apszFailed );

    GDALGetGCPs = (const GDAL_GCP *(*)(GDALDatasetH))
        GBGetSymbolCheck( szPath, "GDALGetGCPs", apszFailed );

    GDALGetRasterDataType = (GDALDataType (*)(GDALRasterBandH))
        GBGetSymbolCheck( szPath, "GDALGetRasterDataType", apszFailed );

    GDALGetRasterBandXSize = (int (*)(GDALRasterBandH))
        GBGetSymbolCheck( szPath, "GDALGetRasterBandXSize", apszFailed );

    GDALGetRasterBandYSize = (int (*)(GDALRasterBandH))
        GBGetSymbolCheck( szPath, "GDALGetRasterBandYSize", apszFailed );

    GDALGetBlockSize = (void (*)(GDALRasterBandH, int *, int *))
        GBGetSymbolCheck( szPath, "GDALGetBlockSize", apszFailed );

    GDALRasterIO = (CPLErr (*)(GDALRasterBandH, GDALRWFlag, int, int, int, int,
                               void *, int, int, GDALDataType, int, int ))
        GBGetSymbolCheck( szPath, "GDALRasterIO", apszFailed );

    GDALReadBlock = (CPLErr (*)(GDALRasterBandH, int, int, void *))
        GBGetSymbolCheck( szPath, "GDALReadBlock", apszFailed );
    
    GDALWriteBlock = (CPLErr (*)(GDALRasterBandH, int, int, void *))
        GBGetSymbolCheck( szPath, "GDALWriteBlock", apszFailed );

    GDALGetOverviewCount = (int (*)(GDALRasterBandH))
        GBGetSymbolCheck( szPath, "GDALGetOverviewCount", apszFailed );

    GDALGetOverview = (GDALRasterBandH (*)(GDALRasterBandH, int))
        GBGetSymbolCheck( szPath, "GDALGetOverview", apszFailed );

    GDALGetRasterNoDataValue = (double (*)(GDALRasterBandH, int*))
        GBGetSymbolCheck( szPath, "GDALGetRasterNoDataValue", apszFailed );

    GDALSetRasterNoDataValue = (CPLErr (*)(GDALRasterBandH, double))
        GBGetSymbolCheck( szPath, "GDALSetRasterNoDataValue", apszFailed );

    GDALFillRaster = (CPLErr (*)(GDALRasterBandH, double, double))
        GBGetSymbolCheck( szPath, "GDALFillRaster", apszFailed );

    GDALGetRasterMinimum = (double (*)(GDALRasterBandH, int *))
        GBGetSymbolCheck( szPath, "GDALGetRasterMinimum", apszFailed );
        
    GDALGetRasterMaximum = (double (*)(GDALRasterBandH, int *))
        GBGetSymbolCheck( szPath, "GDALGetRasterMaximum", apszFailed );
        
    GDALComputeRasterMinMax = (void (*)(GDALRasterBandH, int, double *))
        GBGetSymbolCheck( szPath, "GDALComputeRasterMinMax", apszFailed );
        
    GDALGetRasterColorInterpretation = (GDALColorInterp (*)(GDALRasterBandH))
        GBGetSymbolCheck( szPath, "GDALGetRasterColorInterpretation", apszFailed );

    GDALGetColorInterpretationName = (const char *(*)(GDALColorInterp))
        GBGetSymbolCheck( szPath, "GDALGetColorInterpretationName", apszFailed );

    GDALGetRasterColorTable = (GDALColorTableH (*)(GDALRasterBandH))
        GBGetSymbolCheck( szPath, "GDALGetRasterColorTable", apszFailed );

    GDALDecToDMS = (const char *(*)(double, const char *, int ))
        GBGetSymbolCheck( szPath, "GDALDecToDMS", apszFailed );

    GDALGetPaletteInterpretation = (GDALPaletteInterp (*)(GDALColorTableH))
        GBGetSymbolCheck( szPath, "GDALGetPaletteInterpretation", apszFailed );

    GDALGetPaletteInterpretationName = (const char *(*)(GDALPaletteInterp))
        GBGetSymbolCheck( szPath, "GDALGetPaletteInterpretationName", apszFailed );

    GDALGetColorEntryCount = (int (*)(GDALColorTableH))
        GBGetSymbolCheck( szPath, "GDALGetColorEntryCount", apszFailed );

    GDALGetColorEntry = (const GDALColorEntry *(*)(GDALColorTableH,int))
        GBGetSymbolCheck( szPath, "GDALGetColorEntry", apszFailed );

    GDALGetColorEntryAsRGB = (int (*)(GDALColorTableH,int,
                                      GDALColorEntry*))
        GBGetSymbolCheck( szPath, "GDALGetColorEntryAsRGB", apszFailed );
    
    GDALSetColorEntry = (void (*)(GDALColorTableH, int, const GDALColorEntry*))
        GBGetSymbolCheck( szPath, "GDALSetColorEntry", apszFailed );

/* -------------------------------------------------------------------- */
/*      GDALMajorObject                                                 */
/* -------------------------------------------------------------------- */
    GDALGetMetadata = (char **(*)(GDALMajorObjectH, const char *))
        GBGetSymbolCheck( szPath, "GDALGetMetadata", apszFailed );
    
    GDALSetMetadata = (CPLErr(*)(GDALMajorObjectH, char **, const char *))
        GBGetSymbolCheck( szPath, "GDALSetMetadata", apszFailed );
    
    GDALGetMetadataItem = (const char *(*)(GDALMajorObjectH, const char *,
                                           const char *))
        GBGetSymbolCheck( szPath, "GDALGetMetadataItem", apszFailed );

    GDALSetMetadataItem = (CPLErr (*)(GDALMajorObjectH, const char *, 
                                      const char *, const char *))
        GBGetSymbolCheck( szPath, "GDALSetMetadataItem", apszFailed );
    
/* -------------------------------------------------------------------- */
/*      CPL                                                             */
/* -------------------------------------------------------------------- */
    CPLErrorReset = (void (*)())
        GBGetSymbolCheck( szPath, "CPLErrorReset", apszFailed );

    CPLGetLastErrorNo = (int (*)())
        GBGetSymbolCheck( szPath, "CPLGetLastErrorNo", apszFailed );

    CPLGetLastErrorType = (CPLErr (*)())
        GBGetSymbolCheck( szPath, "CPLGetLastErrorType", apszFailed );

    CPLGetLastErrorMsg = (const char *(*)())
        GBGetSymbolCheck( szPath, "CPLGetLastErrorMsg", apszFailed );

    CPLPushErrorHandler = (void (*)(CPLErrorHandler))
        GBGetSymbolCheck( szPath, "CPLPushErrorHandler", apszFailed );

    CPLPopErrorHandler = (void (*)())
        GBGetSymbolCheck( szPath, "CPLPopErrorHandler", apszFailed );

/* -------------------------------------------------------------------- */
/*      OSR API                                                         */
/* -------------------------------------------------------------------- */
    OSRNewSpatialReference = (OGRSpatialReferenceH (*)( const char * ))
        GBGetSymbolCheck( szPath, "OSRNewSpatialReference", apszFailed );

    OSRCloneGeogCS = (OGRSpatialReferenceH (*)(OGRSpatialReferenceH))
        GBGetSymbolCheck( szPath, "OSRCloneGeogCS", apszFailed );

    OSRDestroySpatialReference = (void (*)(OGRSpatialReferenceH))
        GBGetSymbolCheck( szPath, "OSRDestroySpatialReference", apszFailed );

    OSRReference = (int (*)(OGRSpatialReferenceH))
        GBGetSymbolCheck( szPath, "OSRReference", apszFailed );

    OSRDereference = (int (*)(OGRSpatialReferenceH))
        GBGetSymbolCheck( szPath, "OSRDereference", apszFailed );

    OSRImportFromEPSG = (OGRErr (*)(OGRSpatialReferenceH,int))
        GBGetSymbolCheck( szPath, "OSRImportFromEPSG", apszFailed );

    OSRImportFromWkt = (OGRErr (*)(OGRSpatialReferenceH,char **))
        GBGetSymbolCheck( szPath, "OSRImportFromWkt", apszFailed );

    OSRImportFromProj4 = (OGRErr (*)(OGRSpatialReferenceH,const char *))
        GBGetSymbolCheck( szPath, "OSRImportFromProj4", apszFailed );

    OSRExportToWkt = (OGRErr (*)(OGRSpatialReferenceH, char **))
        GBGetSymbolCheck( szPath, "OSRExportToWkt", apszFailed );
    
    OSRExportToPrettyWkt = (OGRErr (*)(OGRSpatialReferenceH, char **, int))
        GBGetSymbolCheck( szPath, "OSRExportToPrettyWkt", apszFailed );
    
    OSRExportToProj4 = (OGRErr (*)(OGRSpatialReferenceH, char **))
        GBGetSymbolCheck( szPath, "OSRExportToProj4", apszFailed );
    
    OSRSetAttrValue = (OGRErr (*)(OGRSpatialReferenceH, const char *, 
                                  const char *))
        GBGetSymbolCheck( szPath, "OSRSetAttrValue", apszFailed );
    
    OSRGetAttrValue = (const char *(*)(OGRSpatialReferenceH, const char *,int))
        GBGetSymbolCheck( szPath, "OSRGetAttrValue", apszFailed );
    
    OSRSetLinearUnits = (OGRErr (*)(OGRSpatialReferenceH, const char *,double))
        GBGetSymbolCheck( szPath, "OSRSetLinearUnits", apszFailed );
    
    OSRGetLinearUnits = (double (*)(OGRSpatialReferenceH, char **))
        GBGetSymbolCheck( szPath, "OSRGetLinearUnits", apszFailed );
    
    OSRIsGeographic = (int (*)(OGRSpatialReferenceH))
        GBGetSymbolCheck( szPath, "OSRIsGeographic", apszFailed );
    
    OSRIsProjected = (int (*)(OGRSpatialReferenceH))
        GBGetSymbolCheck( szPath, "OSRIsProjected", apszFailed );
    
    OSRIsSameGeogCS = (int (*)(OGRSpatialReferenceH,OGRSpatialReferenceH))
        GBGetSymbolCheck( szPath, "OSRIsSameGeogCS", apszFailed );
    
    OSRIsSame = (int (*)(OGRSpatialReferenceH,OGRSpatialReferenceH))
        GBGetSymbolCheck( szPath, "OSRIsSame", apszFailed );
    
    OSRSetProjCS = (OGRErr (*)(OGRSpatialReferenceH,const char*))
        GBGetSymbolCheck( szPath, "OSRSetProjCS", apszFailed );

    OSRSetWellKnownGeogCS = (OGRErr (*)(OGRSpatialReferenceH, const char *))
        GBGetSymbolCheck( szPath, "OSRSetWellKnownGeogCS", apszFailed );

    OSRSetGeogCS = (OGRErr (*)( OGRSpatialReferenceH hSRS,
                                const char * pszGeogName,
                                const char * pszDatumName,
                                const char * pszEllipsoidName,
                                double dfSemiMajor, double dfInvFlattening,
                                const char * pszPMName /* = NULL */,
                                double dfPMOffset /* = 0.0 */,
                                const char * pszUnits /* = NULL */,
                                double dfConvertToRadians /* = 0.0 */ ))
        GBGetSymbolCheck( szPath, "OSRSetGeogCS", apszFailed );
        
    OSRGetSemiMajor = (double (*)(OGRSpatialReferenceH, OGRErr *))
        GBGetSymbolCheck( szPath, "OSRGetSemiMajor", apszFailed );

    OSRGetSemiMinor = (double (*)(OGRSpatialReferenceH, OGRErr *))
        GBGetSymbolCheck( szPath, "OSRGetSemiMinor", apszFailed );

    OSRGetInvFlattening = (double (*)(OGRSpatialReferenceH, OGRErr *))
        GBGetSymbolCheck( szPath, "OSRGetInvFlattening", apszFailed );

    OSRSetAuthority = (OGRErr (*)(OGRSpatialReferenceH, const char *, 
                                  const char *, int))
        GBGetSymbolCheck( szPath, "OSRSetAuthority", apszFailed );

    OSRSetProjParm = (OGRErr (*)(OGRSpatialReferenceH, const char *, double))
        GBGetSymbolCheck( szPath, "OSRSetProjParm", apszFailed );

    OSRGetProjParm = (double (*)(OGRSpatialReferenceH, const char *, 
                                 double, OGRErr *))
        GBGetSymbolCheck( szPath, "OSRGetProjParm", apszFailed );

    OSRSetUTM = (OGRErr (*)(OGRSpatialReferenceH, int, int))
        GBGetSymbolCheck( szPath, "OSRSetUTM", apszFailed );

    OSRGetUTMZone = (int (*)(OGRSpatialReferenceH, int *))
        GBGetSymbolCheck( szPath, "OSRGetUTMZone", apszFailed );

    OCTNewCoordinateTransformation = (OGRCoordinateTransformationH 
                     (*)(OGRSpatialReferenceH, OGRSpatialReferenceH))
        GBGetSymbolCheck( szPath, "OCTNewCoordinateTransformation",apszFailed);

    OCTDestroyCoordinateTransformation = 
        (void (*)(OGRCoordinateTransformationH))
        GBGetSymbolCheck( szPath, "OCTDestroyCoordinateTransformation",
                          apszFailed );

    OCTTransform = (int (*)(OGRCoordinateTransformationH, int, 
                            double *, double *, double *))
        GBGetSymbolCheck( szPath, "OCTTransform", apszFailed );

/* -------------------------------------------------------------------- */
/*      Did we fail to find any entry points?                           */
/* -------------------------------------------------------------------- */
    if( apszFailed[0] != NULL && fpReportFailure != NULL )
    {
        int	iError;
        
        fprintf( fpReportFailure, 
                 "While a GDAL .DLL/.so was found at `%s'\n"
                 "it appears to be missing the following entry points.\n"
                 "Consider upgrading to a more recent GDAL library.\n",
                 szPath );
        
        for( iError = 0; apszFailed[iError] != NULL; iError++ )
        {
            fprintf( fpReportFailure, "  o %s\n", apszFailed[iError] );
            free( apszFailed[iError] );
        }
    }

    return apszFailed[0] == NULL;
}