-
Notifications
You must be signed in to change notification settings - Fork 4
/
FFI.pm
2133 lines (1955 loc) · 107 KB
/
FFI.pm
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
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package Geo::GDAL::FFI;
use v5.10;
use strict;
use warnings;
use Carp;
use PDL::Types ();
use Config (); # needed to silence some FFI::Platypus warnings
use FFI::Platypus;
use FFI::Platypus::Buffer;
require Exporter;
require B;
use Sort::Versions;
use Geo::GDAL::FFI::VSI;
use Geo::GDAL::FFI::VSI::File;
use Geo::GDAL::FFI::SpatialReference;
use Geo::GDAL::FFI::Object;
use Geo::GDAL::FFI::Driver;
use Geo::GDAL::FFI::Dataset;
use Geo::GDAL::FFI::Band;
use Geo::GDAL::FFI::Layer;
use Geo::GDAL::FFI::FeatureDefn;
use Geo::GDAL::FFI::FieldDefn;
use Geo::GDAL::FFI::GeomFieldDefn;
use Geo::GDAL::FFI::Feature;
use Geo::GDAL::FFI::Geometry;
our $VERSION = 0.1300;
our $DEBUG = 0;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(@errors GetVersionInfo SetErrorHandling UnsetErrorHandling
Capabilities OpenFlags DataTypes ResamplingMethods
FieldTypes FieldSubtypes Justifications ColorInterpretations
GeometryTypes GeometryFormats GridAlgorithms
GetDriver GetDrivers IdentifyDriver Open
HaveGEOS SetConfigOption GetConfigOption
FindFile PushFinderLocation PopFinderLocation FinderClean);
our %EXPORT_TAGS = (all => \@EXPORT_OK);
our $None = 0;
our $Debug = 1;
our $Warning = 2;
our $Failure = 3;
our $Fatal = 4;
our %ogr_errors = (
1 => 'NOT_ENOUGH_DATA',
2 => 'NOT_ENOUGH_MEMORY',
3 => 'UNSUPPORTED_GEOMETRY_TYPE',
4 => 'UNSUPPORTED_OPERATION',
5 => 'CORRUPT_DATA',
6 => 'FAILURE',
7 => 'UNSUPPORTED_SRS',
8 => 'INVALID_HANDLE',
9 => 'NON_EXISTING_FEATURE',
);
our $Read = 0;
our $Write = 1;
our @errors;
our %immutable;
my %parent_ref_hash;
#say STDERR "XXX " . $ENV{LD_LIBRARY_PATH};
#my $instance = __PACKAGE__->new;
my $instance;
sub SetErrorHandling {
return unless $instance;
return if exists $instance->{CPLErrorHandler};
$instance->{CPLErrorHandler} = $instance->{ffi}->closure(
sub {
my ($err_cat, $err_num, $msg) = @_;
if ($err_cat == $None) {
} elsif ($err_cat == $Debug) {
if ($DEBUG) {
print STDERR $msg;
}
} elsif ($err_cat == $Warning) {
warn $msg;
} else {
push @errors, $msg;
}
});
$instance->{CPLErrorHandler}->sticky;
CPLPushErrorHandler($instance->{CPLErrorHandler});
}
sub UnsetErrorHandling {
return unless $instance;
return unless exists $instance->{CPLErrorHandler};
$instance->{CPLErrorHandler}->unstick;
CPLPopErrorHandler($instance->{CPLErrorHandler});
delete $instance->{CPLErrorHandler};
}
sub error_msg {
my $args = shift;
return unless @errors || $args;
unless (@errors) {
return $ogr_errors{$args->{OGRError}} if $args->{OGRError};
return "Unknown error.";
}
my $msg = join("\n", @errors);
@errors = ();
return $msg;
}
# internal methods
sub _register_parent_ref {
my ($gdal_handle, $parent) = @_;
# ensure $gdal_handle is not blessed?
confess "gdal handle is undefined"
if !defined $gdal_handle;
confess "Parent ref is undefined"
if !$parent;
$parent_ref_hash{$gdal_handle} = $parent;
}
sub _deregister_parent_ref {
my ($gdal_handle) = @_;
# we get undef vals in global cleanup
return if !$gdal_handle;
delete $parent_ref_hash{$gdal_handle};
}
sub _get_parent_ref {
my ($gdal_handle) = @_;
warn "Attempting to access non-existent parent"
if !$parent_ref_hash{$gdal_handle};
return $parent_ref_hash{$gdal_handle}
}
our %capabilities = (
OPEN => 1,
CREATE => 2,
CREATECOPY => 3,
VIRTUALIO => 4,
RASTER => 5,
VECTOR => 6,
GNM => 7,
NOTNULL_FIELDS => 8,
DEFAULT_FIELDS => 9,
NOTNULL_GEOMFIELDS => 10,
NONSPATIAL => 11,
FEATURE_STYLES => 12,
);
sub Capabilities {
return sort {$capabilities{$a} <=> $capabilities{$b}} keys %capabilities;
}
our %open_flags = (
READONLY => 0x00,
UPDATE => 0x01,
ALL => 0x00,
RASTER => 0x02,
VECTOR => 0x04,
GNM => 0x08,
SHARED => 0x20,
VERBOSE_ERROR => 0x40,
INTERNAL => 0x80,
ARRAY_BLOCK_ACCESS => 0x100,
HASHSET_BLOCK_ACCESS => 0x200,
);
sub OpenFlags {
return sort {$open_flags{$a} <=> $open_flags{$b}} keys %open_flags;
}
our %data_types = (
Unknown => 0,
Byte => 1,
UInt16 => 2,
Int16 => 3,
UInt32 => 4,
Int32 => 5,
Float32 => 6,
Float64 => 7,
CInt16 => 8,
CInt32 => 9,
CFloat32 => 10,
CFloat64 => 11
);
our %data_types_reverse = reverse %data_types;
sub DataTypes {
return sort {$data_types{$a} <=> $data_types{$b}} keys %data_types;
}
our %rat_field_type = (
Integer => 0,
Real => 1,
String => 2
);
our %rat_field_usage = (
Generic => 0,
PixelCount => 1,
Name => 2,
Min => 3,
Max => 4,
MinMax => 5,
Red => 6,
Green => 7,
Blue => 8,
Alpha => 9,
RedMin => 10,
GreenMin => 11,
BlueMin => 12,
AlphaMin => 13,
RedMax => 14,
GreenMax => 15,
BlueMax => 16,
AlphaMax => 17,
);
our %rat_table_type = (
THEMATIC => 0,
ATHEMATIC => 1
);
our %resampling = (
NearestNeighbour => 0,
Bilinear => 1,
Cubic => 2,
CubicSpline => 3,
ORA_Lanczos => 4,
Average => 5,
Mode => 6,
Gauss => 7
);
sub ResamplingMethods {
return sort {$resampling{$a} <=> $resampling{$b}} keys %resampling;
}
our %data_type2pdl_data_type = (
Byte => $PDL::Types::PDL_B,
Int16 => $PDL::Types::PDL_S,
UInt16 => $PDL::Types::PDL_US,
Int32 => $PDL::Types::PDL_L,
Float32 => $PDL::Types::PDL_F,
Float64 => $PDL::Types::PDL_D,
);
our %pdl_data_type2data_type = reverse %data_type2pdl_data_type;
our %field_types = (
Integer => 0,
IntegerList => 1,
Real => 2,
RealList => 3,
String => 4,
StringList => 5,
#WideString => 6, # do not use
#WideStringList => 7, # do not use
Binary => 8,
Date => 9,
Time => 10,
DateTime => 11,
Integer64 => 12,
Integer64List => 13,
);
our %field_types_reverse = reverse %field_types;
sub FieldTypes {
return sort {$field_types{$a} <=> $field_types{$b}} keys %field_types;
}
our %field_subtypes = (
None => 0,
Boolean => 1,
Int16 => 2,
Float32 => 3
);
our %field_subtypes_reverse = reverse %field_subtypes;
sub FieldSubtypes {
return sort {$field_subtypes{$a} <=> $field_subtypes{$b}} keys %field_subtypes;
}
our %justification = (
Undefined => 0,
Left => 1,
Right => 2
);
our %justification_reverse = reverse %justification;
sub Justifications {
return sort {$justification{$a} <=> $justification{$b}} keys %justification;
}
our %color_interpretations = (
Undefined => 0,
GrayIndex => 1,
PaletteIndex => 2,
RedBand => 3,
GreenBand => 4,
BlueBand => 5,
AlphaBand => 6,
HueBand => 7,
SaturationBand => 8,
LightnessBand => 9,
CyanBand => 10,
MagentaBand => 11,
YellowBand => 12,
BlackBand => 13,
YCbCr_YBand => 14,
YCbCr_CbBand => 15,
YCbCr_CrBand => 16,
);
our %color_interpretations_reverse = reverse %color_interpretations;
sub ColorInterpretations {
return sort {$color_interpretations{$a} <=> $color_interpretations{$b}} keys %color_interpretations;
}
our %geometry_types = (
Unknown => 0,
Point => 1,
LineString => 2,
Polygon => 3,
MultiPoint => 4,
MultiLineString => 5,
MultiPolygon => 6,
GeometryCollection => 7,
CircularString => 8,
CompoundCurve => 9,
CurvePolygon => 10,
MultiCurve => 11,
MultiSurface => 12,
Curve => 13,
Surface => 14,
PolyhedralSurface => 15,
TIN => 16,
Triangle => 17,
None => 100,
LinearRing => 101,
CircularStringZ => 1008,
CompoundCurveZ => 1009,
CurvePolygonZ => 1010,
MultiCurveZ => 1011,
MultiSurfaceZ => 1012,
CurveZ => 1013,
SurfaceZ => 1014,
PolyhedralSurfaceZ => 1015,
TINZ => 1016,
TriangleZ => 1017,
PointM => 2001,
LineStringM => 2002,
PolygonM => 2003,
MultiPointM => 2004,
MultiLineStringM => 2005,
MultiPolygonM => 2006,
GeometryCollectionM => 2007,
CircularStringM => 2008,
CompoundCurveM => 2009,
CurvePolygonM => 2010,
MultiCurveM => 2011,
MultiSurfaceM => 2012,
CurveM => 2013,
SurfaceM => 2014,
PolyhedralSurfaceM => 2015,
TINM => 2016,
TriangleM => 2017,
PointZM => 3001,
LineStringZM => 3002,
PolygonZM => 3003,
MultiPointZM => 3004,
MultiLineStringZM => 3005,
MultiPolygonZM => 3006,
GeometryCollectionZM => 3007,
CircularStringZM => 3008,
CompoundCurveZM => 3009,
CurvePolygonZM => 3010,
MultiCurveZM => 3011,
MultiSurfaceZM => 3012,
CurveZM => 3013,
SurfaceZM => 3014,
PolyhedralSurfaceZM => 3015,
TINZM => 3016,
TriangleZM => 3017,
Point25D => 0x80000001,
LineString25D => 0x80000002,
Polygon25D => 0x80000003,
MultiPoint25D => 0x80000004,
MultiLineString25D => 0x80000005,
MultiPolygon25D => 0x80000006,
GeometryCollection25D => 0x80000007
);
our %geometry_types_reverse = reverse %geometry_types;
sub GeometryTypes {
return sort {$geometry_types{$a} <=> $geometry_types{$b}} keys %geometry_types;
}
our %geometry_formats = (
WKT => 1,
);
sub GeometryFormats {
return sort {$geometry_formats{$a} <=> $geometry_formats{$b}} keys %geometry_formats;
}
our %grid_algorithms = (
InverseDistanceToAPower => 1,
MovingAverage => 2,
NearestNeighbor => 3,
MetricMinimum => 4,
MetricMaximum => 5,
MetricRange => 6,
MetricCount => 7,
MetricAverageDistance => 8,
MetricAverageDistancePts => 9,
Linear => 10,
InverseDistanceToAPowerNearestNeighbor => 11
);
sub GridAlgorithms {
return sort {$grid_algorithms{$a} <=> $grid_algorithms{$b}} keys %grid_algorithms;
}
sub isint {
my $value = shift;
my $b_obj = B::svref_2object(\$value);
my $flags = $b_obj->FLAGS;
return 1 if $flags & B::SVp_IOK() && !($flags & B::SVp_NOK()) && !($flags & B::SVp_POK());
}
sub new {
my $class = shift;
my $gdal = shift;
return $instance if $instance;
my $ffi = FFI::Platypus->new;
my @libs = $gdal->dynamic_libs;
$ffi->lib(@libs);
$ffi->type('(pointer,size_t,size_t,opaque)->size_t' => 'VSIWriteFunction');
$ffi->type('(int,int,string)->void' => 'CPLErrorHandler');
$ffi->type('(double,string,pointer)->int' => 'GDALProgressFunc');
$ffi->type('(pointer,int, pointer,int,int,unsigned int,unsigned int,int,int)->int' => 'GDALDerivedPixelFunc');
$ffi->type('(pointer,int,int,pointer,pointer,pointer,pointer)->int' => 'GDALTransformerFunc');
$ffi->type('(double,int,pointer,pointer,pointer)->int' => 'GDALContourWriter');
$ffi->type('(string,string,sint64,sint64,pointer)->void' => 'GDALQueryLoggerFunc');
$ffi->type('(string,pointer,pointer,int,int,pointer,pointer,pointer,pointer,pointer,pointer)->int' => 'GDALVRTProcessedDatasetFuncInit');
$ffi->type('(string,pointer,pointer)->void' => 'GDALVRTProcessedDatasetFuncFree');
$ffi->type('(string,pointer,pointer,int,int,int,pointer,size_t,int,int,pointer,pointer,size_t,int,int,pointer,double,double,double,double,pointer,string,int)->int' => 'GDALVRTProcessedDatasetFuncProcess');
$ffi->ignore_not_found(1);
# from port/*.h
$ffi->attach(VSIMalloc => [qw/uint/] => 'opaque');
croak "Can't attach to GDAL methods. Problem with GDAL dynamic libs: '@libs'?" unless $class->can('VSIMalloc');
$ffi->attach(VSIFree => ['opaque'] => 'void');
$ffi->attach(CPLError => [qw/int int string/] => 'void');
$ffi->attach(VSIFOpenL => [qw/string string/] => 'opaque');
$ffi->attach(VSIFOpenExL => [qw/string string int/] => 'opaque');
$ffi->attach(VSIFCloseL => ['opaque'] => 'int');
$ffi->attach(VSIFWriteL => [qw/opaque uint uint opaque/] => 'uint');
$ffi->attach(VSIFReadL => [qw/opaque uint uint opaque/] => 'uint');
$ffi->attach(VSIIngestFile => [qw/opaque string string* uint64* sint64/] => 'int');
$ffi->attach(VSIMkdir => [qw/string sint64/] => 'int');
$ffi->attach(VSIRmdir => [qw/string/] => 'int');
$ffi->attach(VSIReadDirEx => [qw/string int/] => 'opaque');
$ffi->attach(VSIUnlink => [qw/string/] => 'int');
$ffi->attach(VSIRename => [qw/string string/] => 'int');
$ffi->attach(VSIStdoutSetRedirection => ['VSIWriteFunction', 'opaque'] => 'void');
$ffi->attach(CPLSetErrorHandler => ['CPLErrorHandler'] => 'opaque');
$ffi->attach(CPLPushErrorHandler => ['CPLErrorHandler'] => 'void');
$ffi->attach(CPLPopErrorHandler => ['CPLErrorHandler'] => 'void');
$ffi->attach(CSLDestroy => ['opaque'] => 'void');
$ffi->attach(CSLAddString => ['opaque', 'string'] => 'opaque');
$ffi->attach(CSLCount => ['opaque'] => 'int');
$ffi->attach(CSLGetField => ['opaque', 'int'] => 'string');
$ffi->attach(CPLGetConfigOption => ['string', 'string'] => 'string');
$ffi->attach(CPLSetConfigOption => ['string', 'string'] => 'void');
$ffi->attach(CPLFindFile => ['string', 'string'] => 'string');
$ffi->attach(CPLPushFinderLocation => ['string'] => 'void');
$ffi->attach(CPLPopFinderLocation => [] => 'void');
$ffi->attach(CPLFinderClean => [] => 'void');
# from ogr_core.h
$ffi->attach( 'OGR_GT_Flatten' => ['unsigned int'] => 'unsigned int');
# generated with parse_h.pl
# from gcore/gdal.h
$ffi->attach('GDALGetDataTypeSize' => ['unsigned int'] => 'int');
$ffi->attach('GDALGetDataTypeSizeBits' => ['unsigned int'] => 'int');
$ffi->attach('GDALGetDataTypeSizeBytes' => ['unsigned int'] => 'int');
$ffi->attach('GDALDataTypeIsComplex' => ['unsigned int'] => 'int');
$ffi->attach('GDALDataTypeIsInteger' => ['unsigned int'] => 'int');
$ffi->attach('GDALDataTypeIsFloating' => ['unsigned int'] => 'int');
$ffi->attach('GDALDataTypeIsSigned' => ['unsigned int'] => 'int');
$ffi->attach('GDALGetDataTypeName' => ['unsigned int'] => 'string');
$ffi->attach('GDALGetDataTypeByName' => [qw/string/] => 'unsigned int');
$ffi->attach('GDALDataTypeUnion' => ['unsigned int','unsigned int'] => 'unsigned int');
$ffi->attach('GDALDataTypeUnionWithValue' => ['unsigned int','double','int'] => 'unsigned int');
$ffi->attach('GDALFindDataType' => [qw/int int int int/] => 'unsigned int');
$ffi->attach('GDALFindDataTypeForValue' => [qw/double int/] => 'unsigned int');
$ffi->attach('GDALAdjustValueToDataType' => ['unsigned int','double','int*','int*'] => 'double');
$ffi->attach('GDALGetNonComplexDataType' => ['unsigned int'] => 'unsigned int');
$ffi->attach('GDALDataTypeIsConversionLossy' => ['unsigned int','unsigned int'] => 'int');
$ffi->attach('GDALGetAsyncStatusTypeName' => ['unsigned int'] => 'string');
$ffi->attach('GDALGetAsyncStatusTypeByName' => [qw/string/] => 'unsigned int');
$ffi->attach('GDALGetColorInterpretationName' => ['unsigned int'] => 'string');
$ffi->attach('GDALGetColorInterpretationByName' => [qw/string/] => 'unsigned int');
$ffi->attach('GDALGetPaletteInterpretationName' => ['unsigned int'] => 'string');
$ffi->attach('GDALAllRegister' => [] => 'void');
$ffi->attach('GDALCreate' => ['opaque','string','int','int','int','unsigned int','opaque'] => 'opaque');
$ffi->attach('GDALCreateCopy' => [qw/opaque string opaque int opaque GDALProgressFunc opaque/] => 'opaque');
$ffi->attach('GDALIdentifyDriver' => [qw/string opaque/] => 'opaque');
$ffi->attach('GDALIdentifyDriverEx' => ['string','unsigned int','opaque','opaque'] => 'opaque');
$ffi->attach('GDALOpen' => ['string','unsigned int'] => 'opaque');
$ffi->attach('GDALOpenShared' => ['string','unsigned int'] => 'opaque');
$ffi->attach('GDALOpenEx' => ['string','unsigned int','opaque','opaque','opaque'] => 'opaque');
$ffi->attach('GDALDumpOpenDatasets' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetDriverByName' => [qw/string/] => 'opaque');
$ffi->attach('GDALGetDriverCount' => [] => 'int');
$ffi->attach('GDALGetDriver' => [qw/int/] => 'opaque');
$ffi->attach('GDALCreateDriver' => [] => 'opaque');
$ffi->attach('GDALDestroyDriver' => [qw/opaque/] => 'void');
$ffi->attach('GDALRegisterDriver' => [qw/opaque/] => 'int');
$ffi->attach('GDALDeregisterDriver' => [qw/opaque/] => 'void');
$ffi->attach('GDALDestroyDriverManager' => [] => 'void');
$ffi->attach('GDALDestroy' => [] => 'void');
$ffi->attach('GDALDeleteDataset' => [qw/opaque string/] => 'int');
$ffi->attach('GDALRenameDataset' => [qw/opaque string string/] => 'int');
$ffi->attach('GDALCopyDatasetFiles' => [qw/opaque string string/] => 'int');
$ffi->attach('GDALValidateCreationOptions' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALGetDriverShortName' => [qw/opaque/] => 'string');
$ffi->attach('GDALGetDriverLongName' => [qw/opaque/] => 'string');
$ffi->attach('GDALGetDriverHelpTopic' => [qw/opaque/] => 'string');
$ffi->attach('GDALGetDriverCreationOptionList' => [qw/opaque/] => 'string');
$ffi->attach('GDALInitGCPs' => [qw/int opaque/] => 'void');
$ffi->attach('GDALDeinitGCPs' => [qw/int opaque/] => 'void');
$ffi->attach('GDALDuplicateGCPs' => [qw/int opaque/] => 'opaque');
$ffi->attach('GDALGCPsToGeoTransform' => [qw/int opaque double* int/] => 'int');
$ffi->attach('GDALInvGeoTransform' => [qw/double[] double[]/] => 'int');
$ffi->attach('GDALApplyGeoTransform' => [qw/double[6] double double double* double*/] => 'void');
$ffi->attach('GDALComposeGeoTransforms' => [qw/double[6] double[6] double[6]/] => 'void');
$ffi->attach('GDALGetMetadataDomainList' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALGetMetadata' => [qw/opaque string/] => 'opaque');
$ffi->attach('GDALSetMetadata' => [qw/opaque opaque string/] => 'int');
$ffi->attach('GDALGetMetadataItem' => [qw/opaque string string/] => 'string');
$ffi->attach('GDALSetMetadataItem' => [qw/opaque string string string/] => 'int');
$ffi->attach('GDALGetDescription' => [qw/opaque/] => 'string');
$ffi->attach('GDALSetDescription' => [qw/opaque string/] => 'void');
$ffi->attach('GDALGetDatasetDriver' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALGetFileList' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALClose' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetRasterXSize' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetRasterYSize' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetRasterCount' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetRasterBand' => [qw/opaque int/] => 'opaque');
$ffi->attach('GDALAddBand' => ['opaque','unsigned int','opaque'] => 'int');
$ffi->attach('GDALBeginAsyncReader' => ['opaque','int','int','int','int','opaque','int','int','unsigned int','int','int*','int','int','int','opaque'] => 'opaque');
$ffi->attach('GDALEndAsyncReader' => [qw/opaque opaque/] => 'void');
$ffi->attach('GDALDatasetRasterIO' => ['opaque','unsigned int','int','int','int','int','opaque','int','int','unsigned int','int','int*','int','int','int'] => 'int');
$ffi->attach('GDALDatasetRasterIOEx' => ['opaque','unsigned int','int','int','int','int','opaque','int','int','unsigned int','int','int*','sint64','sint64','sint64','opaque'] => 'int');
$ffi->attach('GDALDatasetAdviseRead' => ['opaque','int','int','int','int','int','int','unsigned int','int','int*','opaque'] => 'int');
$ffi->attach('GDALDatasetGetCompressionFormats' => [qw/opaque int int int int int int*/] => 'opaque');
$ffi->attach('GDALDatasetReadCompressedData' => [qw/opaque string int int int int int int* opaque size_t string*/] => 'int');
$ffi->attach('GDALGetProjectionRef' => [qw/opaque/] => 'string');
$ffi->attach('GDALGetSpatialRef' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALSetProjection' => [qw/opaque string/] => 'int');
$ffi->attach('GDALSetSpatialRef' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALGetGeoTransform' => [qw/opaque double[6]/] => 'int');
$ffi->attach('GDALSetGeoTransform' => [qw/opaque double[6]/] => 'int');
$ffi->attach('GDALGetGCPCount' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetGCPProjection' => [qw/opaque/] => 'string');
$ffi->attach('GDALGetGCPSpatialRef' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALGetGCPs' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALSetGCPs' => [qw/opaque int opaque string/] => 'int');
$ffi->attach('GDALSetGCPs2' => [qw/opaque int opaque opaque/] => 'int');
$ffi->attach('GDALGetInternalHandle' => [qw/opaque string/] => 'opaque');
$ffi->attach('GDALReferenceDataset' => [qw/opaque/] => 'int');
$ffi->attach('GDALDereferenceDataset' => [qw/opaque/] => 'int');
$ffi->attach('GDALReleaseDataset' => [qw/opaque/] => 'int');
$ffi->attach('GDALBuildOverviews' => [qw/opaque string int int* int int* GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALBuildOverviewsEx' => [qw/opaque string int int* int int* GDALProgressFunc opaque opaque/] => 'int');
$ffi->attach('GDALGetOpenDatasets' => [qw/uint64* int*/] => 'void');
$ffi->attach('GDALGetAccess' => [qw/opaque/] => 'int');
$ffi->attach('GDALFlushCache' => [qw/opaque/] => 'int');
$ffi->attach('GDALCreateDatasetMaskBand' => [qw/opaque int/] => 'int');
$ffi->attach('GDALDatasetCopyWholeRaster' => [qw/opaque opaque opaque GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALRasterBandCopyWholeRaster' => [qw/opaque opaque opaque GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALRegenerateOverviews' => [qw/opaque int uint64* string GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALRegenerateOverviewsEx' => [qw/opaque int uint64* string GDALProgressFunc opaque opaque/] => 'int');
$ffi->attach('GDALDatasetGetLayerCount' => [qw/opaque/] => 'int');
$ffi->attach('GDALDatasetGetLayer' => [qw/opaque int/] => 'opaque');
$ffi->attach('GDALDatasetGetLayerByName' => [qw/opaque string/] => 'opaque');
$ffi->attach('GDALDatasetIsLayerPrivate' => [qw/opaque int/] => 'int');
$ffi->attach('GDALDatasetDeleteLayer' => [qw/opaque int/] => 'int');
$ffi->attach('GDALDatasetCreateLayer' => ['opaque','string','opaque','unsigned int','opaque'] => 'opaque');
$ffi->attach('GDALDatasetCopyLayer' => [qw/opaque opaque string opaque/] => 'opaque');
$ffi->attach('GDALDatasetResetReading' => [qw/opaque/] => 'void');
$ffi->attach('GDALDatasetGetNextFeature' => [qw/opaque uint64* double* GDALProgressFunc opaque/] => 'opaque');
$ffi->attach('GDALDatasetTestCapability' => [qw/opaque string/] => 'int');
$ffi->attach('GDALDatasetExecuteSQL' => [qw/opaque string opaque string/] => 'opaque');
$ffi->attach('GDALDatasetAbortSQL' => [qw/opaque/] => 'int');
$ffi->attach('GDALDatasetReleaseResultSet' => [qw/opaque opaque/] => 'void');
$ffi->attach('GDALDatasetGetStyleTable' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALDatasetSetStyleTableDirectly' => [qw/opaque opaque/] => 'void');
$ffi->attach('GDALDatasetSetStyleTable' => [qw/opaque opaque/] => 'void');
$ffi->attach('GDALDatasetStartTransaction' => [qw/opaque int/] => 'int');
$ffi->attach('GDALDatasetCommitTransaction' => [qw/opaque/] => 'int');
$ffi->attach('GDALDatasetRollbackTransaction' => [qw/opaque/] => 'int');
$ffi->attach('GDALDatasetClearStatistics' => [qw/opaque/] => 'void');
$ffi->attach('GDALDatasetGetFieldDomainNames' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('GDALDatasetGetFieldDomain' => [qw/opaque string/] => 'opaque');
$ffi->attach('GDALDatasetAddFieldDomain' => [qw/opaque opaque string*/] => 'bool');
$ffi->attach('GDALDatasetDeleteFieldDomain' => [qw/opaque string string*/] => 'bool');
$ffi->attach('GDALDatasetUpdateFieldDomain' => [qw/opaque opaque string*/] => 'bool');
$ffi->attach('GDALDatasetGetRelationshipNames' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('GDALDatasetGetRelationship' => [qw/opaque string/] => 'opaque');
$ffi->attach('GDALDatasetAddRelationship' => [qw/opaque opaque string*/] => 'bool');
$ffi->attach('GDALDatasetDeleteRelationship' => [qw/opaque string string*/] => 'bool');
$ffi->attach('GDALDatasetUpdateRelationship' => [qw/opaque opaque string*/] => 'bool');
$ffi->attach('GDALDatasetSetQueryLoggerFunc' => [qw/opaque GDALQueryLoggerFunc opaque/] => 'bool');
$ffi->attach('GDALGetRasterDataType' => [qw/opaque/] => 'unsigned int');
$ffi->attach('GDALGetBlockSize' => [qw/opaque int* int*/] => 'void');
$ffi->attach('GDALGetActualBlockSize' => [qw/opaque int int int* int*/] => 'int');
$ffi->attach('GDALRasterAdviseRead' => ['opaque','int','int','int','int','int','int','unsigned int','opaque'] => 'int');
$ffi->attach('GDALRasterIO' => ['opaque','unsigned int','int','int','int','int','opaque','int','int','unsigned int','int','int'] => 'int');
$ffi->attach('GDALRasterIOEx' => ['opaque','unsigned int','int','int','int','int','opaque','int','int','unsigned int','sint64','sint64','opaque'] => 'int');
$ffi->attach('GDALReadBlock' => [qw/opaque int int opaque/] => 'int');
$ffi->attach('GDALWriteBlock' => [qw/opaque int int opaque/] => 'int');
$ffi->attach('GDALGetRasterBandXSize' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetRasterBandYSize' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetRasterAccess' => [qw/opaque/] => 'unsigned int');
$ffi->attach('GDALGetBandNumber' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetBandDataset' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALGetRasterColorInterpretation' => [qw/opaque/] => 'unsigned int');
$ffi->attach('GDALSetRasterColorInterpretation' => ['opaque','unsigned int'] => 'int');
$ffi->attach('GDALGetRasterColorTable' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALSetRasterColorTable' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALHasArbitraryOverviews' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetOverviewCount' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetOverview' => [qw/opaque int/] => 'opaque');
$ffi->attach('GDALGetRasterNoDataValue' => [qw/opaque int*/] => 'double');
$ffi->attach('GDALGetRasterNoDataValueAsInt64' => [qw/opaque int*/] => 'int');
$ffi->attach('GDALGetRasterNoDataValueAsUInt64' => [qw/opaque int*/] => 'uint64');
$ffi->attach('GDALSetRasterNoDataValue' => [qw/opaque double/] => 'int');
$ffi->attach('GDALSetRasterNoDataValueAsInt64' => [qw/opaque int/] => 'int');
$ffi->attach('GDALSetRasterNoDataValueAsUInt64' => [qw/opaque uint64/] => 'int');
$ffi->attach('GDALDeleteRasterNoDataValue' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetRasterCategoryNames' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALSetRasterCategoryNames' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALGetRasterMinimum' => [qw/opaque int*/] => 'double');
$ffi->attach('GDALGetRasterMaximum' => [qw/opaque int*/] => 'double');
$ffi->attach('GDALGetRasterStatistics' => [qw/opaque int int double* double* double* double*/] => 'int');
$ffi->attach('GDALComputeRasterStatistics' => [qw/opaque int double* double* double* double* GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALSetRasterStatistics' => [qw/opaque double double double double/] => 'int');
$ffi->attach('GDALRasterBandAsMDArray' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALGetRasterUnitType' => [qw/opaque/] => 'string');
$ffi->attach('GDALSetRasterUnitType' => [qw/opaque string/] => 'int');
$ffi->attach('GDALGetRasterOffset' => [qw/opaque int*/] => 'double');
$ffi->attach('GDALSetRasterOffset' => [qw/opaque double/] => 'int');
$ffi->attach('GDALGetRasterScale' => [qw/opaque int*/] => 'double');
$ffi->attach('GDALSetRasterScale' => [qw/opaque double/] => 'int');
$ffi->attach('GDALComputeRasterMinMax' => [qw/opaque int double/] => 'int');
$ffi->attach('GDALFlushRasterCache' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetRasterHistogram' => [qw/opaque double double int int* int int GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALGetRasterHistogramEx' => [qw/opaque double double int uint64* int int GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALGetDefaultHistogram' => [qw/opaque double* double* int* int* int GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALGetDefaultHistogramEx' => [qw/opaque double* double* int* uint64* int GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALSetDefaultHistogram' => [qw/opaque double double int int*/] => 'int');
$ffi->attach('GDALSetDefaultHistogramEx' => [qw/opaque double double int uint64*/] => 'int');
$ffi->attach('GDALGetRandomRasterSample' => [qw/opaque int float*/] => 'int');
$ffi->attach('GDALGetRasterSampleOverview' => [qw/opaque int/] => 'opaque');
$ffi->attach('GDALGetRasterSampleOverviewEx' => [qw/opaque uint64/] => 'opaque');
$ffi->attach('GDALFillRaster' => [qw/opaque double double/] => 'int');
$ffi->attach('GDALComputeBandStats' => [qw/opaque int double* double* GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALOverviewMagnitudeCorrection' => [qw/opaque int uint64* GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALGetDefaultRAT' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALSetDefaultRAT' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALAddDerivedBandPixelFunc' => [qw/string GDALDerivedPixelFunc/] => 'int');
$ffi->attach('GDALAddDerivedBandPixelFuncWithArgs' => [qw/string GDALDerivedPixelFunc string/] => 'int');
$ffi->attach('GDALGetMaskBand' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALGetMaskFlags' => [qw/opaque/] => 'int');
$ffi->attach('GDALCreateMaskBand' => [qw/opaque int/] => 'int');
$ffi->attach('GDALIsMaskBand' => [qw/opaque/] => 'bool');
$ffi->attach('GDALGetDataCoverageStatus' => [qw/opaque int int int int int double*/] => 'int');
$ffi->attach('GDALARGetNextUpdatedRegion' => [qw/opaque double int* int* int* int*/] => 'unsigned int');
$ffi->attach('GDALARLockBuffer' => [qw/opaque double/] => 'int');
$ffi->attach('GDALARUnlockBuffer' => [qw/opaque/] => 'void');
$ffi->attach('GDALGeneralCmdLineProcessor' => [qw/int string* int/] => 'int');
$ffi->attach('GDALSwapWords' => [qw/opaque int int int/] => 'void');
$ffi->attach('GDALSwapWordsEx' => [qw/opaque int size_t int/] => 'void');
$ffi->attach('GDALCopyWords' => ['opaque','unsigned int','int','opaque','unsigned int','int','int'] => 'void');
$ffi->attach('GDALCopyWords64' => ['opaque','unsigned int','int','opaque','unsigned int','int','int'] => 'void');
$ffi->attach('GDALCopyBits' => [qw/pointer int int pointer int int int int/] => 'void');
$ffi->attach('GDALDeinterleave' => ['opaque','unsigned int','int','opaque','unsigned int','size_t'] => 'void');
$ffi->attach('GDALLoadWorldFile' => [qw/string double*/] => 'int');
$ffi->attach('GDALReadWorldFile' => [qw/string string double*/] => 'int');
$ffi->attach('GDALWriteWorldFile' => [qw/string string double*/] => 'int');
$ffi->attach('GDALLoadTabFile' => [qw/string double* string* int* opaque/] => 'int');
$ffi->attach('GDALReadTabFile' => [qw/string double* string* int* opaque/] => 'int');
$ffi->attach('GDALLoadOziMapFile' => [qw/string double* string* int* opaque/] => 'int');
$ffi->attach('GDALReadOziMapFile' => [qw/string double* string* int* opaque/] => 'int');
$ffi->attach('GDALDecToDMS' => [qw/double string int/] => 'string');
$ffi->attach('GDALPackedDMSToDec' => [qw/double/] => 'double');
$ffi->attach('GDALDecToPackedDMS' => [qw/double/] => 'double');
$ffi->attach('GDALVersionInfo' => [qw/string/] => 'string');
$ffi->attach('GDALCheckVersion' => [qw/int int string/] => 'int');
$ffi->attach('GDALExtractRPCInfoV1' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALExtractRPCInfoV2' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALCreateColorTable' => ['unsigned int'] => 'opaque');
$ffi->attach('GDALDestroyColorTable' => [qw/opaque/] => 'void');
$ffi->attach('GDALCloneColorTable' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALGetPaletteInterpretation' => [qw/opaque/] => 'unsigned int');
$ffi->attach('GDALGetColorEntryCount' => [qw/opaque/] => 'int');
$ffi->attach('GDALGetColorEntry' => [qw/opaque int/] => 'short[4]');
$ffi->attach('GDALGetColorEntryAsRGB' => [qw/opaque int short[4]/] => 'int');
$ffi->attach('GDALSetColorEntry' => [qw/opaque int short[4]/] => 'void');
$ffi->attach('GDALCreateColorRamp' => [qw/opaque int short[4] int short[4]/] => 'void');
$ffi->attach('GDALCreateRasterAttributeTable' => [] => 'opaque');
$ffi->attach('GDALDestroyRasterAttributeTable' => [qw/opaque/] => 'void');
$ffi->attach('GDALRATGetColumnCount' => [qw/opaque/] => 'int');
$ffi->attach('GDALRATGetNameOfCol' => [qw/opaque int/] => 'string');
$ffi->attach('GDALRATGetUsageOfCol' => [qw/opaque int/] => 'unsigned int');
$ffi->attach('GDALRATGetTypeOfCol' => [qw/opaque int/] => 'unsigned int');
$ffi->attach('GDALRATGetColOfUsage' => ['opaque','unsigned int'] => 'int');
$ffi->attach('GDALRATGetRowCount' => [qw/opaque/] => 'int');
$ffi->attach('GDALRATGetValueAsString' => [qw/opaque int int/] => 'string');
$ffi->attach('GDALRATGetValueAsInt' => [qw/opaque int int/] => 'int');
$ffi->attach('GDALRATGetValueAsDouble' => [qw/opaque int int/] => 'double');
$ffi->attach('GDALRATSetValueAsString' => [qw/opaque int int string/] => 'void');
$ffi->attach('GDALRATSetValueAsInt' => [qw/opaque int int int/] => 'void');
$ffi->attach('GDALRATSetValueAsDouble' => [qw/opaque int int double/] => 'void');
$ffi->attach('GDALRATChangesAreWrittenToFile' => [qw/opaque/] => 'int');
$ffi->attach('GDALRATValuesIOAsDouble' => ['opaque','unsigned int','int','int','int','double*'] => 'int');
$ffi->attach('GDALRATValuesIOAsInteger' => ['opaque','unsigned int','int','int','int','int*'] => 'int');
$ffi->attach('GDALRATValuesIOAsString' => ['opaque','unsigned int','int','int','int','opaque'] => 'int');
$ffi->attach('GDALRATSetRowCount' => [qw/opaque int/] => 'void');
$ffi->attach('GDALRATCreateColumn' => ['opaque','string','unsigned int','unsigned int'] => 'int');
$ffi->attach('GDALRATSetLinearBinning' => [qw/opaque double double/] => 'int');
$ffi->attach('GDALRATGetLinearBinning' => [qw/opaque double* double*/] => 'int');
$ffi->attach('GDALRATSetTableType' => ['opaque','unsigned int'] => 'int');
$ffi->attach('GDALRATGetTableType' => [qw/opaque/] => 'unsigned int');
$ffi->attach('GDALRATInitializeFromColorTable' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALRATTranslateToColorTable' => [qw/opaque int/] => 'opaque');
$ffi->attach('GDALRATDumpReadable' => [qw/opaque opaque/] => 'void');
$ffi->attach('GDALRATClone' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALRATSerializeJSON' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALRATGetRowOfValue' => [qw/opaque double/] => 'int');
$ffi->attach('GDALRATRemoveStatistics' => [qw/opaque/] => 'void');
$ffi->attach('GDALRelationshipCreate' => ['string','string','string','unsigned int'] => 'opaque');
$ffi->attach('GDALDestroyRelationship' => [qw/opaque/] => 'void');
$ffi->attach('GDALRelationshipGetName' => [qw/opaque/] => 'string');
$ffi->attach('GDALRelationshipGetCardinality' => [qw/opaque/] => 'unsigned int');
$ffi->attach('GDALRelationshipGetLeftTableName' => [qw/opaque/] => 'string');
$ffi->attach('GDALRelationshipGetRightTableName' => [qw/opaque/] => 'string');
$ffi->attach('GDALRelationshipGetMappingTableName' => [qw/opaque/] => 'string');
$ffi->attach('GDALRelationshipSetMappingTableName' => [qw/opaque string/] => 'void');
$ffi->attach('GDALRelationshipGetLeftTableFields' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALRelationshipGetRightTableFields' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALRelationshipSetLeftTableFields' => [qw/opaque opaque/] => 'void');
$ffi->attach('GDALRelationshipSetRightTableFields' => [qw/opaque opaque/] => 'void');
$ffi->attach('GDALRelationshipGetLeftMappingTableFields' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALRelationshipGetRightMappingTableFields' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALRelationshipSetLeftMappingTableFields' => [qw/opaque opaque/] => 'void');
$ffi->attach('GDALRelationshipSetRightMappingTableFields' => [qw/opaque opaque/] => 'void');
$ffi->attach('GDALRelationshipGetType' => [qw/opaque/] => 'unsigned int');
$ffi->attach('GDALRelationshipSetType' => ['opaque','unsigned int'] => 'void');
$ffi->attach('GDALRelationshipGetForwardPathLabel' => [qw/opaque/] => 'string');
$ffi->attach('GDALRelationshipSetForwardPathLabel' => [qw/opaque string/] => 'void');
$ffi->attach('GDALRelationshipGetBackwardPathLabel' => [qw/opaque/] => 'string');
$ffi->attach('GDALRelationshipSetBackwardPathLabel' => [qw/opaque string/] => 'void');
$ffi->attach('GDALRelationshipGetRelatedTableType' => [qw/opaque/] => 'string');
$ffi->attach('GDALRelationshipSetRelatedTableType' => [qw/opaque string/] => 'void');
$ffi->attach('GDALSetCacheMax' => [qw/int/] => 'void');
$ffi->attach('GDALGetCacheMax' => [] => 'int');
$ffi->attach('GDALGetCacheUsed' => [] => 'int');
$ffi->attach('GDALSetCacheMax64' => [qw/sint64/] => 'void');
$ffi->attach('GDALGetCacheMax64' => [] => 'sint64');
$ffi->attach('GDALGetCacheUsed64' => [] => 'sint64');
$ffi->attach('GDALFlushCacheBlock' => [] => 'int');
$ffi->attach('GDALDatasetGetVirtualMem' => ['opaque','unsigned int','int','int','int','int','int','int','unsigned int','int','int*','int','sint64','sint64','size_t','size_t','int','opaque'] => 'opaque');
$ffi->attach('GDALRasterBandGetVirtualMem' => ['opaque','unsigned int','int','int','int','int','int','int','unsigned int','int','sint64','size_t','size_t','int','opaque'] => 'opaque');
$ffi->attach('GDALGetVirtualMemAuto' => ['opaque','unsigned int','int*','sint64*','opaque'] => 'opaque');
$ffi->attach('GDALDatasetGetTiledVirtualMem' => ['opaque','unsigned int','int','int','int','int','int','int','unsigned int','int','int*','unsigned int','size_t','int','opaque'] => 'opaque');
$ffi->attach('GDALRasterBandGetTiledVirtualMem' => ['opaque','unsigned int','int','int','int','int','int','int','unsigned int','size_t','int','opaque'] => 'opaque');
$ffi->attach('GDALCreatePansharpenedVRT' => [qw/string opaque int uint64*/] => 'opaque');
$ffi->attach('GDALGetJPEG2000Structure' => [qw/string opaque/] => 'opaque');
$ffi->attach('GDALCreateMultiDimensional' => [qw/opaque string opaque opaque/] => 'opaque');
$ffi->attach('GDALExtendedDataTypeCreate' => ['unsigned int'] => 'opaque');
$ffi->attach('GDALExtendedDataTypeCreateString' => [qw/size_t/] => 'opaque');
$ffi->attach('GDALExtendedDataTypeCreateStringEx' => [qw/size_t int/] => 'opaque');
$ffi->attach('GDALExtendedDataTypeCreateCompound' => [qw/string size_t size_t opaque/] => 'opaque');
$ffi->attach('GDALExtendedDataTypeRelease' => [qw/opaque/] => 'void');
$ffi->attach('GDALExtendedDataTypeGetName' => [qw/opaque/] => 'string');
$ffi->attach('GDALExtendedDataTypeGetClass' => [qw/opaque/] => 'int');
$ffi->attach('GDALExtendedDataTypeGetNumericDataType' => [qw/opaque/] => 'unsigned int');
$ffi->attach('GDALExtendedDataTypeGetSize' => [qw/opaque/] => 'size_t');
$ffi->attach('GDALExtendedDataTypeGetMaxStringLength' => [qw/opaque/] => 'size_t');
$ffi->attach('GDALExtendedDataTypeGetComponents' => [qw/opaque size_t/] => 'uint64*');
$ffi->attach('GDALExtendedDataTypeFreeComponents' => [qw/uint64* size_t/] => 'void');
$ffi->attach('GDALExtendedDataTypeCanConvertTo' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALExtendedDataTypeEquals' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALExtendedDataTypeGetSubType' => [qw/opaque/] => 'int');
$ffi->attach('GDALEDTComponentCreate' => [qw/string size_t opaque/] => 'opaque');
$ffi->attach('GDALEDTComponentRelease' => [qw/opaque/] => 'void');
$ffi->attach('GDALEDTComponentGetName' => [qw/opaque/] => 'string');
$ffi->attach('GDALEDTComponentGetOffset' => [qw/opaque/] => 'size_t');
$ffi->attach('GDALEDTComponentGetType' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALDatasetGetRootGroup' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALGroupRelease' => [qw/opaque/] => 'void');
$ffi->attach('GDALGroupGetName' => [qw/opaque/] => 'string');
$ffi->attach('GDALGroupGetFullName' => [qw/opaque/] => 'string');
$ffi->attach('GDALGroupGetMDArrayNames' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('GDALGroupOpenMDArray' => [qw/opaque string opaque/] => 'opaque');
$ffi->attach('GDALGroupOpenMDArrayFromFullname' => [qw/opaque string opaque/] => 'opaque');
$ffi->attach('GDALGroupResolveMDArray' => [qw/opaque string string opaque/] => 'opaque');
$ffi->attach('GDALGroupGetGroupNames' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('GDALGroupOpenGroup' => [qw/opaque string opaque/] => 'opaque');
$ffi->attach('GDALGroupOpenGroupFromFullname' => [qw/opaque string opaque/] => 'opaque');
$ffi->attach('GDALGroupGetVectorLayerNames' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('GDALGroupOpenVectorLayer' => [qw/opaque string opaque/] => 'opaque');
$ffi->attach('GDALGroupGetDimensions' => [qw/opaque size_t opaque/] => 'uint64*');
$ffi->attach('GDALGroupGetAttribute' => [qw/opaque string/] => 'opaque');
$ffi->attach('GDALGroupGetAttributes' => [qw/opaque size_t opaque/] => 'uint64*');
$ffi->attach('GDALGroupGetStructuralInfo' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALGroupCreateGroup' => [qw/opaque string opaque/] => 'opaque');
$ffi->attach('GDALGroupCreateDimension' => [qw/opaque string string string uint64 opaque/] => 'opaque');
$ffi->attach('GDALGroupCreateMDArray' => [qw/opaque string size_t uint64* opaque opaque/] => 'opaque');
$ffi->attach('GDALGroupCreateAttribute' => [qw/opaque string size_t uint64* opaque opaque/] => 'opaque');
$ffi->attach('GDALMDArrayRelease' => [qw/opaque/] => 'void');
$ffi->attach('GDALMDArrayGetName' => [qw/opaque/] => 'string');
$ffi->attach('GDALMDArrayGetFullName' => [qw/opaque/] => 'string');
$ffi->attach('GDALMDArrayGetTotalElementsCount' => [qw/opaque/] => 'uint64');
$ffi->attach('GDALMDArrayGetDimensionCount' => [qw/opaque/] => 'size_t');
$ffi->attach('GDALMDArrayGetDimensions' => [qw/opaque size_t/] => 'uint64*');
$ffi->attach('GDALMDArrayGetDataType' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALMDArrayRead' => [qw/opaque uint64* size_t sint64 int* opaque opaque opaque size_t/] => 'int');
$ffi->attach('GDALMDArrayWrite' => [qw/opaque uint64* size_t sint64 int* opaque opaque opaque size_t/] => 'int');
$ffi->attach('GDALMDArrayAdviseRead' => [qw/opaque uint64* size_t/] => 'int');
$ffi->attach('GDALMDArrayAdviseReadEx' => [qw/opaque uint64* size_t opaque/] => 'int');
$ffi->attach('GDALMDArrayGetAttribute' => [qw/opaque string/] => 'opaque');
$ffi->attach('GDALMDArrayGetAttributes' => [qw/opaque size_t opaque/] => 'uint64*');
$ffi->attach('GDALMDArrayCreateAttribute' => [qw/opaque string size_t uint64* opaque opaque/] => 'opaque');
$ffi->attach('GDALMDArrayResize' => [qw/opaque uint64* opaque/] => 'bool');
$ffi->attach('GDALMDArrayGetRawNoDataValue' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALMDArrayGetNoDataValueAsDouble' => [qw/opaque int*/] => 'double');
$ffi->attach('GDALMDArrayGetNoDataValueAsInt64' => [qw/opaque int*/] => 'int');
$ffi->attach('GDALMDArrayGetNoDataValueAsUInt64' => [qw/opaque int*/] => 'uint64');
$ffi->attach('GDALMDArraySetRawNoDataValue' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALMDArraySetNoDataValueAsDouble' => [qw/opaque double/] => 'int');
$ffi->attach('GDALMDArraySetNoDataValueAsInt64' => [qw/opaque int/] => 'int');
$ffi->attach('GDALMDArraySetNoDataValueAsUInt64' => [qw/opaque uint64/] => 'int');
$ffi->attach('GDALMDArraySetScale' => [qw/opaque double/] => 'int');
$ffi->attach('GDALMDArraySetScaleEx' => ['opaque','double','unsigned int'] => 'int');
$ffi->attach('GDALMDArrayGetScale' => [qw/opaque int*/] => 'double');
$ffi->attach('GDALMDArrayGetScaleEx' => ['opaque','int*','unsigned int'] => 'double');
$ffi->attach('GDALMDArraySetOffset' => [qw/opaque double/] => 'int');
$ffi->attach('GDALMDArraySetOffsetEx' => ['opaque','double','unsigned int'] => 'int');
$ffi->attach('GDALMDArrayGetOffset' => [qw/opaque int*/] => 'double');
$ffi->attach('GDALMDArrayGetOffsetEx' => ['opaque','int*','unsigned int'] => 'double');
$ffi->attach('GDALMDArrayGetBlockSize' => [qw/opaque size_t/] => 'uint64');
$ffi->attach('GDALMDArraySetUnit' => [qw/opaque string/] => 'int');
$ffi->attach('GDALMDArrayGetUnit' => [qw/opaque/] => 'string');
$ffi->attach('GDALMDArraySetSpatialRef' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALMDArrayGetSpatialRef' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALMDArrayGetProcessingChunkSize' => [qw/opaque size_t size_t/] => 'size_t');
$ffi->attach('GDALMDArrayGetStructuralInfo' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALMDArrayGetView' => [qw/opaque string/] => 'opaque');
$ffi->attach('GDALMDArrayTranspose' => [qw/opaque size_t int*/] => 'opaque');
$ffi->attach('GDALMDArrayGetUnscaled' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALMDArrayGetMask' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('GDALMDArrayAsClassicDataset' => [qw/opaque size_t size_t/] => 'opaque');
$ffi->attach('GDALMDArrayGetStatistics' => [qw/opaque opaque int int double* double* double* double* uint64 GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALMDArrayComputeStatistics' => [qw/opaque opaque int double* double* double* double* uint64 GDALProgressFunc opaque/] => 'int');
$ffi->attach('GDALMDArrayGetResampled' => [qw/opaque size_t opaque int opaque opaque/] => 'opaque');
$ffi->attach('GDALMDArrayGetGridded' => [qw/opaque string opaque opaque opaque/] => 'opaque');
$ffi->attach('GDALMDArrayGetCoordinateVariables' => [qw/opaque size_t/] => 'uint64*');
$ffi->attach('GDALReleaseArrays' => [qw/uint64* size_t/] => 'void');
$ffi->attach('GDALMDArrayCache' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALAttributeRelease' => [qw/opaque/] => 'void');
$ffi->attach('GDALReleaseAttributes' => [qw/uint64* size_t/] => 'void');
$ffi->attach('GDALAttributeGetName' => [qw/opaque/] => 'string');
$ffi->attach('GDALAttributeGetFullName' => [qw/opaque/] => 'string');
$ffi->attach('GDALAttributeGetTotalElementsCount' => [qw/opaque/] => 'uint64');
$ffi->attach('GDALAttributeGetDimensionCount' => [qw/opaque/] => 'size_t');
$ffi->attach('GDALAttributeGetDimensionsSize' => [qw/opaque size_t/] => 'uint64');
$ffi->attach('GDALAttributeGetDataType' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALAttributeReadAsRaw' => [qw/opaque size_t/] => 'pointer');
$ffi->attach('GDALAttributeFreeRawResult' => [qw/opaque pointer size_t/] => 'void');
$ffi->attach('GDALAttributeReadAsString' => [qw/opaque/] => 'string');
$ffi->attach('GDALAttributeReadAsInt' => [qw/opaque/] => 'int');
$ffi->attach('GDALAttributeReadAsDouble' => [qw/opaque/] => 'double');
$ffi->attach('GDALAttributeReadAsStringArray' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALAttributeReadAsIntArray' => [qw/opaque size_t/] => 'int*');
$ffi->attach('GDALAttributeReadAsDoubleArray' => [qw/opaque size_t/] => 'double*');
$ffi->attach('GDALAttributeWriteRaw' => [qw/opaque opaque size_t/] => 'int');
$ffi->attach('GDALAttributeWriteString' => [qw/opaque string/] => 'int');
$ffi->attach('GDALAttributeWriteStringArray' => [qw/opaque opaque/] => 'int');
$ffi->attach('GDALAttributeWriteInt' => [qw/opaque int/] => 'int');
$ffi->attach('GDALAttributeWriteDouble' => [qw/opaque double/] => 'int');
$ffi->attach('GDALAttributeWriteDoubleArray' => [qw/opaque double* size_t/] => 'int');
$ffi->attach('GDALDimensionRelease' => [qw/opaque/] => 'void');
$ffi->attach('GDALReleaseDimensions' => [qw/uint64* size_t/] => 'void');
$ffi->attach('GDALDimensionGetName' => [qw/opaque/] => 'string');
$ffi->attach('GDALDimensionGetFullName' => [qw/opaque/] => 'string');
$ffi->attach('GDALDimensionGetType' => [qw/opaque/] => 'string');
$ffi->attach('GDALDimensionGetDirection' => [qw/opaque/] => 'string');
$ffi->attach('GDALDimensionGetSize' => [qw/opaque/] => 'uint64');
$ffi->attach('GDALDimensionGetIndexingVariable' => [qw/opaque/] => 'opaque');
$ffi->attach('GDALDimensionSetIndexingVariable' => [qw/opaque opaque/] => 'int');
# from ogr/ogr_api.h
$ffi->attach('OGRGetGEOSVersion' => [qw/int* int* int*/] => 'bool');
$ffi->attach('OGR_G_CreateFromWkb' => [qw/string opaque uint64* int/] => 'int');
$ffi->attach('OGR_G_CreateFromWkbEx' => [qw/opaque opaque uint64* size_t/] => 'int');
$ffi->attach('OGR_G_CreateFromWkt' => [qw/string* opaque uint64*/] => 'int');
$ffi->attach('OGR_G_CreateFromFgf' => [qw/string opaque uint64* int int*/] => 'int');
$ffi->attach('OGR_G_DestroyGeometry' => [qw/opaque/] => 'void');
$ffi->attach('OGR_G_CreateGeometry' => ['unsigned int'] => 'opaque');
$ffi->attach('OGR_G_ApproximateArcAngles' => [qw/double double double double double double double double double/] => 'opaque');
$ffi->attach('OGR_G_ForceToPolygon' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_ForceToLineString' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_ForceToMultiPolygon' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_ForceToMultiPoint' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_ForceToMultiLineString' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_ForceTo' => ['opaque','unsigned int','opaque'] => 'opaque');
$ffi->attach('OGR_G_RemoveLowerDimensionSubGeoms' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_GetDimension' => [qw/opaque/] => 'int');
$ffi->attach('OGR_G_GetCoordinateDimension' => [qw/opaque/] => 'int');
$ffi->attach('OGR_G_CoordinateDimension' => [qw/opaque/] => 'int');
$ffi->attach('OGR_G_SetCoordinateDimension' => [qw/opaque int/] => 'void');
$ffi->attach('OGR_G_Is3D' => [qw/opaque/] => 'int');
$ffi->attach('OGR_G_IsMeasured' => [qw/opaque/] => 'int');
$ffi->attach('OGR_G_Set3D' => [qw/opaque int/] => 'void');
$ffi->attach('OGR_G_SetMeasured' => [qw/opaque int/] => 'void');
$ffi->attach('OGR_G_Clone' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_GetEnvelope' => [qw/opaque double[4]/] => 'void');
$ffi->attach('OGR_G_GetEnvelope3D' => [qw/opaque double[6]/] => 'void');
$ffi->attach('OGR_G_ImportFromWkb' => [qw/opaque string int/] => 'int');
$ffi->attach('OGR_G_ExportToWkb' => ['opaque','unsigned int','string'] => 'int');
$ffi->attach('OGR_G_ExportToIsoWkb' => ['opaque','unsigned int','string'] => 'int');
$ffi->attach('OGR_G_WkbSize' => [qw/opaque/] => 'int');
$ffi->attach('OGR_G_WkbSizeEx' => [qw/opaque/] => 'size_t');
$ffi->attach('OGR_G_ImportFromWkt' => [qw/opaque string*/] => 'int');
$ffi->attach('OGR_G_ExportToWkt' => [qw/opaque string*/] => 'int');
$ffi->attach('OGR_G_ExportToIsoWkt' => [qw/opaque string*/] => 'int');
$ffi->attach('OGR_G_GetGeometryType' => [qw/opaque/] => 'unsigned int');
$ffi->attach('OGR_G_GetGeometryName' => [qw/opaque/] => 'string');
$ffi->attach('OGR_G_DumpReadable' => [qw/opaque opaque string/] => 'void');
$ffi->attach('OGR_G_FlattenTo2D' => [qw/opaque/] => 'void');
$ffi->attach('OGR_G_CloseRings' => [qw/opaque/] => 'void');
$ffi->attach('OGR_G_CreateFromGML' => [qw/string/] => 'opaque');
$ffi->attach('OGR_G_ExportToGML' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_ExportToGMLEx' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('OGR_G_CreateFromGMLTree' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_ExportToGMLTree' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_ExportEnvelopeToGMLTree' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_ExportToKML' => [qw/opaque string/] => 'opaque');
$ffi->attach('OGR_G_ExportToJson' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_ExportToJsonEx' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('OGR_G_CreateGeometryFromJson' => [qw/string/] => 'opaque');
$ffi->attach('OGR_G_CreateGeometryFromEsriJson' => [qw/string/] => 'opaque');
$ffi->attach('OGR_G_AssignSpatialReference' => [qw/opaque opaque/] => 'void');
$ffi->attach('OGR_G_GetSpatialReference' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_Transform' => [qw/opaque opaque/] => 'int');
$ffi->attach('OGR_G_TransformTo' => [qw/opaque opaque/] => 'int');
$ffi->attach('OGR_GeomTransformer_Create' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('OGR_GeomTransformer_Transform' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('OGR_GeomTransformer_Destroy' => [qw/opaque/] => 'void');
$ffi->attach('OGR_G_Simplify' => [qw/opaque double/] => 'opaque');
$ffi->attach('OGR_G_SimplifyPreserveTopology' => [qw/opaque double/] => 'opaque');
$ffi->attach('OGR_G_DelaunayTriangulation' => [qw/opaque double int/] => 'opaque');
$ffi->attach('OGR_G_Segmentize' => [qw/opaque double/] => 'void');
$ffi->attach('OGR_G_Intersects' => [qw/opaque opaque/] => 'int');
$ffi->attach('OGR_G_Equals' => [qw/opaque opaque/] => 'int');
$ffi->attach('OGR_G_Disjoint' => [qw/opaque opaque/] => 'int');
$ffi->attach('OGR_G_Touches' => [qw/opaque opaque/] => 'int');
$ffi->attach('OGR_G_Crosses' => [qw/opaque opaque/] => 'int');
$ffi->attach('OGR_G_Within' => [qw/opaque opaque/] => 'int');
$ffi->attach('OGR_G_Contains' => [qw/opaque opaque/] => 'int');
$ffi->attach('OGR_G_Overlaps' => [qw/opaque opaque/] => 'int');
$ffi->attach('OGR_G_Boundary' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_ConvexHull' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_ConcaveHull' => [qw/opaque double bool/] => 'opaque');
$ffi->attach('OGR_G_Buffer' => [qw/opaque double int/] => 'opaque');
$ffi->attach('OGR_G_Intersection' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('OGR_G_Union' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('OGR_G_UnionCascaded' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_UnaryUnion' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_PointOnSurface' => [qw/opaque/] => 'opaque');
$ffi->attach('OGR_G_Difference' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('OGR_G_SymDifference' => [qw/opaque opaque/] => 'opaque');
$ffi->attach('OGR_G_Distance' => [qw/opaque opaque/] => 'double');
$ffi->attach('OGR_G_Distance3D' => [qw/opaque opaque/] => 'double');
$ffi->attach('OGR_G_Length' => [qw/opaque/] => 'double');
$ffi->attach('OGR_G_Area' => [qw/opaque/] => 'double');
$ffi->attach('OGR_G_Centroid' => [qw/opaque opaque/] => 'int');