xlsynth-sys 0.75.0

Accelerated Hardware Synthesis (XLS/XLSynth) via Rust (Native Library)
Documentation
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
// SPDX-License-Identifier: Apache-2.0

//! Declarations for the C API for the XLS dynamic shared object.

#![cfg_attr(xlsynth_runtime_runpath, feature(link_arg_attribute))]

#[cfg(xlsynth_runtime_runpath)]
include!(concat!(env!("OUT_DIR"), "/xlsynth_runtime_link_arg.rs"));

extern crate libc;

#[repr(C)]
pub struct CIrValue {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CIrBits {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CBitsRope {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CIrPackage {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CIrFunction {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CIrFunctionBase {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CIrFunctionJit {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

/// Opaque context for the libxls AOT C API.
///
/// The bindings are retained so `xlsynth-sys` covers libxls APIs that are not
/// implemented natively in Rust. The high-level xlsynth AOT API uses the
/// PIR/Cranelift compiler.
#[repr(C)]
pub struct CXlsAotExecContext {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CTraceMessage {
    pub message: *mut std::os::raw::c_char,
    pub verbosity: i64,
}

#[repr(C)]
pub struct CIrType {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CIrFunctionType {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

// Protected C API for IR analysis.
#[repr(C)]
pub struct CIrAnalysis {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CIrIntervalSet {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

// Selects how much work is done to compute ranges.
pub type XlsIrAnalysisLevel = i32;
pub const XLS_IR_ANALYSIS_LEVEL_FAST: XlsIrAnalysisLevel = 0;
pub const XLS_IR_ANALYSIS_LEVEL_RANGE_WITH_CONTEXT: XlsIrAnalysisLevel = 1;

// Options for creating an IR analysis handle.
#[repr(C)]
pub struct XlsIrAnalysisOptions {
    pub level: XlsIrAnalysisLevel,
}

// -- DSLX

#[repr(C)]
pub struct CDslxImportData {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxTypecheckedModule {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxModule {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxTypeInfo {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxStructDef {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxEnumDef {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxSumDef {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxTypeAlias {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxType {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxTypeDim {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxExpr {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxInterpValue {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxParametricEnv {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxEnumMember {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxStructMember {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxTypeAnnotation {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxArrayTypeAnnotation {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxTypeRefTypeAnnotation {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxTypeRef {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxImport {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxColonRef {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxTypeDefinition {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxConstantDef {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxModuleMember {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxFunction {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxParam {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxAttribute {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxParametricBinding {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxCallGraph {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxQuickcheck {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

#[repr(C)]
pub struct CDslxInvocationCalleeDataArray {
    _private: [u8; 0],
}

#[repr(C)]
pub struct CDslxInvocationCalleeData {
    _private: [u8; 0],
}

#[repr(C)]
pub struct CDslxInvocationData {
    _private: [u8; 0],
}

#[repr(C)]
pub struct CDslxInvocation {
    _private: [u8; 0],
}

#[repr(C)]
pub struct CScheduleAndCodegenResult {
    _private: [u8; 0], // Ensures the struct cannot be instantiated
}

pub type XlsFormatPreference = i32;
pub type XlsValueKind = i32;

// Calling convention used for DSLX mangling APIs.
pub type XlsCallingConvention = i32;

pub type DslxTypeDefinitionKind = i32;

pub type DslxModuleMemberKind = i32;

pub type DslxAttributeKind = i32;

pub const XLS_DSLX_ATTRIBUTE_KIND_CFG: DslxAttributeKind = 0;
pub const XLS_DSLX_ATTRIBUTE_KIND_DSLX_FORMAT_DISABLE: DslxAttributeKind = 1;
pub const XLS_DSLX_ATTRIBUTE_KIND_EXTERN_VERILOG: DslxAttributeKind = 2;
pub const XLS_DSLX_ATTRIBUTE_KIND_SV_TYPE: DslxAttributeKind = 3;
pub const XLS_DSLX_ATTRIBUTE_KIND_TEST: DslxAttributeKind = 4;
pub const XLS_DSLX_ATTRIBUTE_KIND_TEST_PROC: DslxAttributeKind = 5;
pub const XLS_DSLX_ATTRIBUTE_KIND_QUICKCHECK: DslxAttributeKind = 6;

pub type DslxAttributeArgumentKind = i32;

pub const XLS_DSLX_ATTRIBUTE_ARGUMENT_KIND_STRING: DslxAttributeArgumentKind = 0;
pub const XLS_DSLX_ATTRIBUTE_ARGUMENT_KIND_STRING_KEY_VALUE: DslxAttributeArgumentKind = 1;
pub const XLS_DSLX_ATTRIBUTE_ARGUMENT_KIND_INT_KEY_VALUE: DslxAttributeArgumentKind = 2;
pub const XLS_DSLX_ATTRIBUTE_ARGUMENT_KIND_STRING_LITERAL: DslxAttributeArgumentKind = 3;

pub const XLS_CALLING_CONVENTION_TYPICAL: XlsCallingConvention = 0;
pub const XLS_CALLING_CONVENTION_IMPLICIT_TOKEN: XlsCallingConvention = 1;
pub const XLS_CALLING_CONVENTION_PROC_NEXT: XlsCallingConvention = 2;

#[repr(C)]
pub struct XlsDslxParametricEnvItem {
    pub identifier: *const std::os::raw::c_char,
    pub value: *const CDslxInterpValue,
}

#[repr(C)]
pub struct XlsDslxFunctionSpecializationRequest {
    pub function_name: *const std::os::raw::c_char,
    pub specialized_name: *const std::os::raw::c_char,
    pub env: *mut CDslxParametricEnv,
}

#[repr(C)]
pub struct CDslxInvocationRewriteRule {
    pub from_callee: *mut CDslxFunction,
    pub to_callee: *mut CDslxFunction,
    pub match_callee_env: *const CDslxParametricEnv,
    pub to_callee_env: *const CDslxParametricEnv,
}

unsafe extern "C" {
    pub fn xls_convert_dslx_to_ir(
        dslx: *const std::os::raw::c_char,
        path: *const std::os::raw::c_char,
        module_name: *const std::os::raw::c_char,
        dslx_stdlib_path: *const std::os::raw::c_char,
        additional_search_paths: *const *const std::os::raw::c_char,
        additional_search_paths_count: libc::size_t,
        error_out: *mut *mut std::os::raw::c_char,
        ir_out: *mut *mut std::os::raw::c_char,
    ) -> bool;

    pub fn xls_convert_dslx_to_ir_with_warnings(
        dslx: *const std::os::raw::c_char,
        path: *const std::os::raw::c_char,
        module_name: *const std::os::raw::c_char,
        dslx_stdlib_path: *const std::os::raw::c_char,
        additional_search_paths: *const *const std::os::raw::c_char,
        additional_search_paths_count: libc::size_t,
        enable_warnings: *const *const std::os::raw::c_char,
        enable_warnings_count: libc::size_t,
        disable_warnings: *const *const std::os::raw::c_char,
        disable_warnings_count: libc::size_t,
        warnings_as_errors: bool,
        force_implicit_token_calling_convention: bool,
        warnings_out: *mut *mut *mut std::os::raw::c_char,
        warnings_out_count: *mut libc::size_t,
        error_out: *mut *mut std::os::raw::c_char,
        ir_out: *mut *mut std::os::raw::c_char,
    ) -> bool;

    pub fn xls_convert_dslx_path_to_ir(
        path: *const std::os::raw::c_char,
        dslx_stdlib_path: *const std::os::raw::c_char,
        additional_search_paths: *const *const std::os::raw::c_char,
        additional_search_paths_count: libc::size_t,
        error_out: *mut *mut std::os::raw::c_char,
        ir_out: *mut *mut std::os::raw::c_char,
    ) -> bool;

    pub fn xls_convert_dslx_path_to_ir_with_warnings(
        path: *const std::os::raw::c_char,
        dslx_stdlib_path: *const std::os::raw::c_char,
        additional_search_paths: *const *const std::os::raw::c_char,
        additional_search_paths_count: libc::size_t,
        enable_warnings: *const *const std::os::raw::c_char,
        enable_warnings_count: libc::size_t,
        disable_warnings: *const *const std::os::raw::c_char,
        disable_warnings_count: libc::size_t,
        warnings_as_errors: bool,
        force_implicit_token_calling_convention: bool,
        warnings_out: *mut *mut *mut std::os::raw::c_char,
        warnings_out_count: *mut libc::size_t,
        error_out: *mut *mut std::os::raw::c_char,
        ir_out: *mut *mut std::os::raw::c_char,
    ) -> bool;

    pub fn xls_parse_typed_value(
        text: *const std::os::raw::c_char,
        error_out: *mut *mut std::os::raw::c_char,
        value_out: *mut *mut CIrValue,
    ) -> bool;
    pub fn xls_value_free(value: *mut CIrValue);

    pub fn xls_value_clone(value: *const CIrValue) -> *mut CIrValue;

    // Extracts a bits value from a (boxed) value or gives an error.
    pub fn xls_value_get_bits(
        value: *const CIrValue,
        error_out: *mut *mut std::os::raw::c_char,
        bits_out: *mut *mut CIrBits,
    ) -> bool;

    // Turns a span of IR values into a tuple value.
    pub fn xls_value_make_tuple(
        value_count: libc::size_t,
        values: *const *const CIrValue,
    ) -> *mut CIrValue;

    // Create a token value
    pub fn xls_value_make_token() -> *mut CIrValue;

    /// Returns an error:
    /// * if the elements do not all have the same type, or
    /// * if the array is empty (because then we cannot determine the element
    ///   type)
    pub fn xls_value_make_array(
        element_count: libc::size_t,
        elements: *const *const CIrValue,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CIrValue,
    ) -> bool;

    // Extracts an element from a tuple/array value or gives an error (e.g. if
    // this value is not a tuple/array or the index is out of bounds).
    pub fn xls_value_get_element(
        tuple: *const CIrValue,
        index: libc::size_t,
        error_out: *mut *mut std::os::raw::c_char,
        element_out: *mut *mut CIrValue,
    ) -> bool;

    pub fn xls_value_get_element_count(
        value: *const CIrValue,
        error_out: *mut *mut std::os::raw::c_char,
        count_out: *mut i64,
    ) -> bool;

    // Creates a bits value (via an unsigned integer) that is boxed in an
    // XlsIrValue.
    pub fn xls_value_make_ubits(
        bit_count: i64,
        value: u64,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CIrValue,
    ) -> bool;

    // Creates a bits value (via a signed integer) that is boxed in an
    // XlsIrValue.
    pub fn xls_value_make_sbits(
        bit_count: i64,
        value: i64,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CIrValue,
    ) -> bool;

    // Boxes an IR bits object into an IR value.
    pub fn xls_value_from_bits(bits: *const CIrBits) -> *mut CIrValue;

    pub fn xls_bits_make_ubits(
        bit_count: i64,
        value: u64,
        error_out: *mut *mut std::os::raw::c_char,
        bits_out: *mut *mut CIrBits,
    ) -> bool;

    pub fn xls_bits_make_sbits(
        bit_count: i64,
        value: i64,
        error_out: *mut *mut std::os::raw::c_char,
        bits_out: *mut *mut CIrBits,
    ) -> bool;

    pub fn xls_bits_free(bits: *mut CIrBits);
    pub fn xls_bits_get_bit_count(bits: *const CIrBits) -> i64;
    pub fn xls_bits_get_bit(bits: *const CIrBits, index: i64) -> bool;
    pub fn xls_bits_eq(bits: *const CIrBits, other: *const CIrBits) -> bool;
    pub fn xls_bits_ne(a: *const CIrBits, b: *const CIrBits) -> bool;
    pub fn xls_bits_ult(a: *const CIrBits, b: *const CIrBits) -> bool;
    pub fn xls_bits_ule(a: *const CIrBits, b: *const CIrBits) -> bool;
    pub fn xls_bits_ugt(a: *const CIrBits, b: *const CIrBits) -> bool;
    pub fn xls_bits_uge(a: *const CIrBits, b: *const CIrBits) -> bool;
    pub fn xls_bits_slt(a: *const CIrBits, b: *const CIrBits) -> bool;
    pub fn xls_bits_sle(a: *const CIrBits, b: *const CIrBits) -> bool;
    pub fn xls_bits_sgt(a: *const CIrBits, b: *const CIrBits) -> bool;
    pub fn xls_bits_sge(a: *const CIrBits, b: *const CIrBits) -> bool;
    pub fn xls_bits_to_debug_string(bits: *const CIrBits) -> *mut std::os::raw::c_char;
    pub fn xls_bits_make_bits_from_bytes(
        bit_count: libc::size_t,
        bytes: *const u8,
        byte_count: libc::size_t,
        error_out: *mut *mut std::os::raw::c_char,
        bits_out: *mut *mut CIrBits,
    ) -> bool;
    pub fn xls_mangle_dslx_name_full(
        module_name: *const std::os::raw::c_char,
        function_name: *const std::os::raw::c_char,
        convention: XlsCallingConvention,
        free_keys: *const *const std::os::raw::c_char,
        free_keys_count: libc::size_t,
        param_env: *const CDslxParametricEnv,
        scope: *const std::os::raw::c_char,
        error_out: *mut *mut std::os::raw::c_char,
        mangled_out: *mut *mut std::os::raw::c_char,
    ) -> bool;
    pub fn xls_bits_add(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_sub(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_umul(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_smul(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_udiv(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_sdiv(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_umod(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_smod(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_negate(bits: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_abs(bits: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_not(bits: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_and(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_or(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;
    pub fn xls_bits_xor(lhs: *const CIrBits, rhs: *const CIrBits) -> *mut CIrBits;

    pub fn xls_bits_shift_left_logical(bits: *const CIrBits, shift_amount: i64) -> *mut CIrBits;
    pub fn xls_bits_shift_right_logical(bits: *const CIrBits, shift_amount: i64) -> *mut CIrBits;
    pub fn xls_bits_shift_right_arithmetic(bits: *const CIrBits, shift_amount: i64)
    -> *mut CIrBits;

    // struct xls_bits* xls_bits_width_slice(const struct xls_bits* bits,
    // int64_t start, int64_t width);

    pub fn xls_bits_width_slice(bits: *const CIrBits, start: i64, width: i64) -> *mut CIrBits;

    pub fn xls_bits_to_bytes(
        bits: *const CIrBits,
        error_out: *mut *mut std::os::raw::c_char,
        bytes_out: *mut *mut u8,
        byte_count_out: *mut libc::size_t,
    ) -> bool;
    pub fn xls_bytes_free(bytes: *mut u8);
    pub fn xls_bits_to_uint64(
        bits: *const CIrBits,
        error_out: *mut *mut std::os::raw::c_char,
        value_out: *mut u64,
    ) -> bool;
    pub fn xls_bits_to_int64(
        bits: *const CIrBits,
        error_out: *mut *mut std::os::raw::c_char,
        value_out: *mut i64,
    ) -> bool;

    pub fn xls_create_bits_rope(bit_count: i64) -> *mut CBitsRope;
    pub fn xls_bits_rope_append_bits(bits_rope: *mut CBitsRope, bits: *const CIrBits);
    pub fn xls_bits_rope_get_bits(bits_rope: *mut CBitsRope) -> *mut CIrBits;
    pub fn xls_bits_rope_free(bits_rope: *mut CBitsRope);

    pub fn xls_package_free(package: *mut CIrPackage);
    pub fn xls_c_str_free(c_str: *mut std::os::raw::c_char);
    pub fn xls_c_strs_free(c_strs: *mut *mut std::os::raw::c_char, count: libc::size_t);
    pub fn xls_value_to_string(
        value: *const CIrValue,
        str_out: *mut *mut std::os::raw::c_char,
    ) -> bool;
    pub fn xls_format_preference_from_string(
        s: *const std::os::raw::c_char,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut XlsFormatPreference,
    ) -> bool;

    pub fn xls_value_to_string_format_preference(
        value: *const CIrValue,
        fmt: XlsFormatPreference,
        error_out: *mut *mut std::os::raw::c_char,
        str_out: *mut *mut std::os::raw::c_char,
    ) -> bool;
    pub fn xls_bits_to_string(
        bits: *const CIrBits,
        fmt: XlsFormatPreference,
        include_bit_count: bool,
        error_out: *mut *mut std::os::raw::c_char,
        str_out: *mut *mut std::os::raw::c_char,
    ) -> bool;

    pub fn xls_value_get_kind(
        value: *const CIrValue,
        error_out: *mut *mut std::os::raw::c_char,
        kind_out: *mut XlsValueKind,
    ) -> bool;
    pub fn xls_value_make_true() -> *mut CIrValue;
    pub fn xls_value_make_false() -> *mut CIrValue;
    pub fn xls_value_from_bits_owned(bits: *mut CIrBits) -> *mut CIrValue;
    pub fn xls_value_flatten_to_bits(value: *const CIrValue) -> *mut CIrBits;

    pub fn xls_value_eq(value: *const CIrValue, value: *const CIrValue) -> bool;
    pub fn xls_parse_ir_package(
        ir: *const std::os::raw::c_char,
        filename: *const std::os::raw::c_char,
        error_out: *mut *mut std::os::raw::c_char,
        xls_package_out: *mut *mut CIrPackage,
    ) -> bool;

    // -- IR analysis APIs

    pub fn xls_ir_analysis_create_from_package(
        p: *mut CIrPackage,
        error_out: *mut *mut std::os::raw::c_char,
        out: *mut *mut CIrAnalysis,
    ) -> bool;

    pub fn xls_ir_analysis_create_from_package_with_options(
        p: *mut CIrPackage,
        options: *const XlsIrAnalysisOptions,
        error_out: *mut *mut std::os::raw::c_char,
        out: *mut *mut CIrAnalysis,
    ) -> bool;

    pub fn xls_ir_analysis_free(a: *mut CIrAnalysis);

    pub fn xls_ir_analysis_get_known_bits_for_node_id(
        a: *const CIrAnalysis,
        node_id: i64,
        error_out: *mut *mut std::os::raw::c_char,
        known_mask_out: *mut *mut CIrBits,
        known_value_out: *mut *mut CIrBits,
    ) -> bool;

    pub fn xls_ir_analysis_get_intervals_for_node_id(
        a: *const CIrAnalysis,
        node_id: i64,
        error_out: *mut *mut std::os::raw::c_char,
        intervals_out: *mut *mut CIrIntervalSet,
    ) -> bool;

    pub fn xls_ir_analysis_at_most_one_bit_true(
        a: *const CIrAnalysis,
        node_id: i64,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut bool,
    ) -> bool;

    pub fn xls_ir_analysis_at_least_one_bit_true(
        a: *const CIrAnalysis,
        node_id: i64,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut bool,
    ) -> bool;

    pub fn xls_ir_analysis_exactly_one_bit_true(
        a: *const CIrAnalysis,
        node_id: i64,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut bool,
    ) -> bool;

    pub fn xls_ir_analysis_known_not_equals(
        a: *const CIrAnalysis,
        lhs_node_id: i64,
        lhs_bit_index: i64,
        rhs_node_id: i64,
        rhs_bit_index: i64,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut bool,
    ) -> bool;

    pub fn xls_ir_analysis_implies(
        a: *const CIrAnalysis,
        lhs_node_id: i64,
        lhs_bit_index: i64,
        rhs_node_id: i64,
        rhs_bit_index: i64,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut bool,
    ) -> bool;

    pub fn xls_interval_set_get_interval_count(s: *const CIrIntervalSet) -> i64;

    pub fn xls_interval_set_get_interval_bounds(
        s: *const CIrIntervalSet,
        i: i64,
        error_out: *mut *mut std::os::raw::c_char,
        lo_out: *mut *mut CIrBits,
        hi_out: *mut *mut CIrBits,
    ) -> bool;

    pub fn xls_interval_set_free(s: *mut CIrIntervalSet);

    pub fn xls_type_to_string(
        t: *const CIrType,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut std::os::raw::c_char,
    ) -> bool;
    pub fn xls_type_get_kind(
        t: *mut CIrType,
        error_out: *mut *mut std::os::raw::c_char,
        kind_out: *mut XlsValueKind,
    ) -> bool;
    pub fn xls_type_get_flat_bit_count(t: *const CIrType) -> i64;
    pub fn xls_type_get_leaf_count(t: *mut CIrType) -> i64;
    pub fn xls_package_get_type_for_value(
        package: *const CIrPackage,
        value: *const CIrValue,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CIrType,
    ) -> bool;
    pub fn xls_package_get_function(
        package: *const CIrPackage,
        function_name: *const std::os::raw::c_char,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CIrFunction,
    ) -> bool;
    pub fn xls_package_get_functions(
        package: *mut CIrPackage,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut *mut CIrFunction,
        count_out: *mut libc::size_t,
    ) -> bool;
    pub fn xls_function_ptr_array_free(function_pointer_array: *mut *mut CIrFunction);
    pub fn xls_function_get_type(
        function: *const CIrFunction,
        error_out: *mut *mut std::os::raw::c_char,
        xls_fn_type_out: *mut *mut CIrFunctionType,
    ) -> bool;
    pub fn xls_function_type_to_string(
        t: *const CIrFunctionType,
        error_out: *mut *mut std::os::raw::c_char,
        string_out: *mut *mut std::os::raw::c_char,
    ) -> bool;
    pub fn xls_function_get_name(
        function: *const CIrFunction,
        error_out: *mut *mut std::os::raw::c_char,
        name_out: *mut *mut std::os::raw::c_char,
    ) -> bool;
    pub fn xls_function_to_z3_smtlib(
        function: *mut CIrFunction,
        error_out: *mut *mut std::os::raw::c_char,
        string_out: *mut *mut std::os::raw::c_char,
    ) -> bool;
    pub fn xls_interpret_function(
        function: *const CIrFunction,
        argc: libc::size_t,
        args: *const *const CIrValue,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CIrValue,
    ) -> bool;
    pub fn xls_optimize_ir(
        ir: *const std::os::raw::c_char,
        top: *const std::os::raw::c_char,
        error_out: *mut *mut std::os::raw::c_char,
        ir_out: *mut *mut std::os::raw::c_char,
    ) -> bool;
    pub fn xls_mangle_dslx_name(
        module_name: *const std::os::raw::c_char,
        function_name: *const std::os::raw::c_char,
        error_out: *mut *mut std::os::raw::c_char,
        mangled_out: *mut *mut std::os::raw::c_char,
    ) -> bool;
    pub fn xls_init_xls(
        usage: *const std::os::raw::c_char,
        argc: libc::c_int,
        argv: *mut *mut std::os::raw::c_char,
    );
    pub fn xls_package_to_string(
        p: *const CIrPackage,
        string_out: *mut *mut std::os::raw::c_char,
    ) -> bool;
    pub fn xls_function_to_string(
        f: *const CIrFunction,
        string_out: *mut *mut std::os::raw::c_char,
    ) -> bool;
    pub fn xls_package_get_top(p: *mut CIrPackage) -> *mut CIrFunctionBase;
    pub fn xls_package_set_top_by_name(
        p: *mut CIrPackage,
        name: *const std::os::raw::c_char,
        error_out: *mut *mut std::os::raw::c_char,
    ) -> bool;

    pub fn xls_verify_package(
        p: *mut CIrPackage,
        error_out: *mut *mut std::os::raw::c_char,
    ) -> bool;

    pub fn xls_make_function_jit(
        function: *const CIrFunction,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CIrFunctionJit,
    ) -> bool;
    pub fn xls_aot_compile_function(
        function: *mut CIrFunction,
        error_out: *mut *mut std::os::raw::c_char,
        object_code_out: *mut *mut u8,
        object_code_count_out: *mut libc::size_t,
        entrypoints_proto_out: *mut *mut u8,
        entrypoints_proto_count_out: *mut libc::size_t,
    ) -> bool;
    pub fn xls_aot_object_code_free(object_code: *mut u8);
    pub fn xls_aot_entrypoints_proto_free(entrypoints_proto: *mut u8);
    pub fn xls_aot_exec_context_create(
        entrypoints_proto: *const u8,
        entrypoints_proto_count: libc::size_t,
        error_out: *mut *mut std::os::raw::c_char,
        out: *mut *mut CXlsAotExecContext,
    ) -> bool;
    pub fn xls_aot_exec_context_clear_events(context: *mut CXlsAotExecContext);
    pub fn xls_aot_exec_context_free(context: *mut CXlsAotExecContext);
    pub fn xls_aot_entrypoint_trampoline(
        function_ptr: usize,
        inputs: *const *const u8,
        outputs: *const *mut u8,
        temp_buffer: *mut libc::c_void,
        context: *mut CXlsAotExecContext,
        continuation_point: i64,
        trace_messages_count_out: *mut libc::size_t,
        assert_messages_count_out: *mut libc::size_t,
    ) -> i64;
    pub fn xls_aot_exec_context_get_trace_message(
        context: *const CXlsAotExecContext,
        index: libc::size_t,
        error_out: *mut *mut std::os::raw::c_char,
        trace_message_out: *mut CTraceMessage,
    ) -> bool;
    pub fn xls_aot_exec_context_get_assert_message(
        context: *const CXlsAotExecContext,
        index: libc::size_t,
        error_out: *mut *mut std::os::raw::c_char,
        assert_message_out: *mut *mut std::os::raw::c_char,
    ) -> bool;
    pub fn xls_function_jit_free(jit: *mut CIrFunctionJit);
    pub fn xls_function_jit_run(
        jit: *const CIrFunctionJit,
        argc: libc::size_t,
        args: *const *const CIrValue,
        error_out: *mut *mut std::os::raw::c_char,
        trace_messages_out: *mut *mut CTraceMessage,
        trace_messages_count_out: *mut libc::size_t,
        assert_messages_out: *mut *mut *mut std::os::raw::c_char,
        assert_messages_count_out: *mut libc::size_t,
        result_out: *mut *mut CIrValue,
    ) -> bool;
    pub fn xls_trace_messages_free(trace_messages: *mut CTraceMessage, count: libc::size_t);

    // -- DSLX

    pub fn xls_dslx_import_data_create(
        dslx_stdlib_path: *const std::os::raw::c_char,
        additional_search_paths: *const *const std::os::raw::c_char,
        additional_search_paths_count: libc::size_t,
    ) -> *mut CDslxImportData;
    pub fn xls_dslx_import_data_free(data: *mut CDslxImportData);

    pub fn xls_dslx_parse_and_typecheck(
        text: *const std::os::raw::c_char,
        path: *const std::os::raw::c_char,
        module_name: *const std::os::raw::c_char,
        import_data: *const CDslxImportData,
        error_out: *mut *mut std::os::raw::c_char,
        typechecked_module_out: *mut *mut CDslxTypecheckedModule,
    ) -> bool;

    pub fn xls_dslx_typechecked_module_clone_removing_functions(
        tm: *mut CDslxTypecheckedModule,
        functions: *mut *mut CDslxFunction,
        function_count: libc::size_t,
        install_subject: *const std::os::raw::c_char,
        import_data: *mut CDslxImportData,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CDslxTypecheckedModule,
    ) -> bool;

    pub fn xls_dslx_typechecked_module_clone_removing_members(
        tm: *mut CDslxTypecheckedModule,
        members: *mut *mut CDslxModuleMember,
        member_count: libc::size_t,
        install_subject: *const std::os::raw::c_char,
        import_data: *mut CDslxImportData,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CDslxTypecheckedModule,
    ) -> bool;

    pub fn xls_dslx_replace_invocations_in_module(
        tm: *mut CDslxTypecheckedModule,
        callers: *const *mut CDslxFunction,
        callers_count: libc::size_t,
        rules: *const CDslxInvocationRewriteRule,
        rules_count: libc::size_t,
        import_data: *mut CDslxImportData,
        install_subject: *const std::os::raw::c_char,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CDslxTypecheckedModule,
    ) -> bool;

    pub fn xls_dslx_typechecked_module_insert_function_specializations(
        typechecked_module: *mut CDslxTypecheckedModule,
        requests: *const XlsDslxFunctionSpecializationRequest,
        request_count: libc::size_t,
        import_data: *mut CDslxImportData,
        install_subject: *const std::os::raw::c_char,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CDslxTypecheckedModule,
    ) -> bool;

    // bool xls_schedule_and_codegen_package(
    // struct xls_package* p, const char* scheduling_options_flags_proto,
    // const char* codegen_flags_proto, bool with_delay_model, char** error_out,
    // struct xls_schedule_and_codegen_result** result_out);
    pub fn xls_schedule_and_codegen_package(
        p: *mut CIrPackage,
        scheduling_options_flags_proto: *const std::os::raw::c_char,
        codegen_flags_proto: *const std::os::raw::c_char,
        with_delay_model: bool,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CScheduleAndCodegenResult,
    ) -> bool;

    pub fn xls_schedule_and_codegen_result_get_verilog_text(
        result: *mut CScheduleAndCodegenResult,
    ) -> *mut std::os::raw::c_char;

    pub fn xls_schedule_and_codegen_result_free(result: *mut CScheduleAndCodegenResult);

    pub fn xls_dslx_typechecked_module_free(module: *mut CDslxTypecheckedModule);

    pub fn xls_dslx_typechecked_module_get_module(
        module: *mut CDslxTypecheckedModule,
    ) -> *mut CDslxModule;

    pub fn xls_dslx_typechecked_module_get_type_info(
        module: *mut CDslxTypecheckedModule,
    ) -> *mut CDslxTypeInfo;

    pub fn xls_dslx_module_to_string(module: *mut CDslxModule) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_module_get_name(module: *const CDslxModule) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_module_get_type_definition_count(module: *const CDslxModule) -> i64;

    pub fn xls_dslx_module_get_member_count(module: *const CDslxModule) -> i64;

    pub fn xls_dslx_module_get_member(module: *const CDslxModule, i: i64)
    -> *mut CDslxModuleMember;

    pub fn xls_dslx_module_get_type_definition_kind(
        module: *const CDslxModule,
        i: i64,
    ) -> DslxTypeDefinitionKind;

    pub fn xls_dslx_module_get_type_definition_as_struct_def(
        module: *const CDslxModule,
        i: i64,
    ) -> *mut CDslxStructDef;
    pub fn xls_dslx_module_get_type_definition_as_enum_def(
        module: *const CDslxModule,
        i: i64,
    ) -> *mut CDslxEnumDef;
    pub fn xls_dslx_module_get_type_definition_as_sum_def(
        module: *const CDslxModule,
        i: i64,
    ) -> *mut CDslxSumDef;
    pub fn xls_dslx_module_get_type_definition_as_type_alias(
        module: *const CDslxModule,
        i: i64,
    ) -> *mut CDslxTypeAlias;

    // -- xls_dslx_module_member
    pub fn xls_dslx_module_member_get_kind(
        member: *const CDslxModuleMember,
    ) -> DslxModuleMemberKind;
    pub fn xls_dslx_module_member_get_constant_def(
        member: *const CDslxModuleMember,
    ) -> *mut CDslxConstantDef;
    pub fn xls_dslx_module_member_get_type_alias(
        member: *const CDslxModuleMember,
    ) -> *mut CDslxTypeAlias;
    pub fn xls_dslx_module_member_get_struct_def(
        member: *const CDslxModuleMember,
    ) -> *mut CDslxStructDef;
    pub fn xls_dslx_module_member_get_enum_def(
        member: *const CDslxModuleMember,
    ) -> *mut CDslxEnumDef;
    pub fn xls_dslx_module_member_get_sum_def(member: *const CDslxModuleMember)
    -> *mut CDslxSumDef;
    pub fn xls_dslx_module_member_get_function(
        member: *const CDslxModuleMember,
    ) -> *mut CDslxFunction;
    pub fn xls_dslx_module_member_get_import(member: *const CDslxModuleMember) -> *mut CDslxImport;
    pub fn xls_dslx_module_member_get_quickcheck(
        member: *const CDslxModuleMember,
    ) -> *mut CDslxQuickcheck;
    pub fn xls_dslx_module_member_from_constant_def(
        constant_def: *mut CDslxConstantDef,
    ) -> *mut CDslxModuleMember;
    pub fn xls_dslx_module_member_from_struct_def(
        struct_def: *mut CDslxStructDef,
    ) -> *mut CDslxModuleMember;
    pub fn xls_dslx_module_member_from_enum_def(
        enum_def: *mut CDslxEnumDef,
    ) -> *mut CDslxModuleMember;
    pub fn xls_dslx_module_member_from_sum_def(sum_def: *mut CDslxSumDef)
    -> *mut CDslxModuleMember;
    pub fn xls_dslx_module_member_from_type_alias(
        type_alias: *mut CDslxTypeAlias,
    ) -> *mut CDslxModuleMember;
    pub fn xls_dslx_module_member_from_function(
        function: *mut CDslxFunction,
    ) -> *mut CDslxModuleMember;
    pub fn xls_dslx_module_member_from_quickcheck(
        quickcheck: *mut CDslxQuickcheck,
    ) -> *mut CDslxModuleMember;

    pub fn xls_dslx_colon_ref_get_attr(
        colon_ref: *const CDslxColonRef,
    ) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_type_info_get_type_struct_def(
        type_info: *mut CDslxTypeInfo,
        node: *mut CDslxStructDef,
    ) -> *mut CDslxType;
    pub fn xls_dslx_type_info_get_type_enum_def(
        type_info: *mut CDslxTypeInfo,
        node: *mut CDslxEnumDef,
    ) -> *mut CDslxType;
    pub fn xls_dslx_type_info_get_type_sum_def(
        type_info: *mut CDslxTypeInfo,
        node: *mut CDslxSumDef,
    ) -> *mut CDslxType;
    pub fn xls_dslx_type_info_get_type_struct_member(
        type_info: *mut CDslxTypeInfo,
        member: *mut CDslxStructMember,
    ) -> *mut CDslxType;
    pub fn xls_dslx_type_info_get_type_constant_def(
        type_info: *mut CDslxTypeInfo,
        node: *mut CDslxConstantDef,
    ) -> *mut CDslxType;

    /// Gets the concrete type for a TypeAnnotation AST node.
    pub fn xls_dslx_type_info_get_type_type_annotation(
        type_info: *mut CDslxTypeInfo,
        type_annotation: *mut CDslxTypeAnnotation,
    ) -> *mut CDslxType;

    pub fn xls_dslx_type_info_get_imported_type_info(
        type_info: *mut CDslxTypeInfo,
        module: *mut CDslxModule,
    ) -> *mut CDslxTypeInfo;

    pub fn xls_dslx_type_info_get_unique_invocation_callee_data(
        type_info: *mut CDslxTypeInfo,
        function: *mut CDslxFunction,
    ) -> *mut CDslxInvocationCalleeDataArray;
    pub fn xls_dslx_type_info_get_all_invocation_callee_data(
        type_info: *mut CDslxTypeInfo,
        function: *mut CDslxFunction,
    ) -> *mut CDslxInvocationCalleeDataArray;
    pub fn xls_dslx_type_info_get_root_invocation_data(
        type_info: *mut CDslxTypeInfo,
        invocation: *mut CDslxInvocation,
    ) -> *mut CDslxInvocationData;

    // -- call_graph
    pub fn xls_dslx_type_info_build_function_call_graph(
        type_info: *mut CDslxTypeInfo,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CDslxCallGraph,
    ) -> bool;

    pub fn xls_dslx_type_info_build_function_call_graph_for_module(
        type_info: *mut CDslxTypeInfo,
        module: *mut CDslxModule,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CDslxCallGraph,
    ) -> bool;

    pub fn xls_dslx_call_graph_free(call_graph: *mut CDslxCallGraph);

    pub fn xls_dslx_call_graph_get_function_count(call_graph: *mut CDslxCallGraph) -> i64;

    pub fn xls_dslx_call_graph_get_function(
        call_graph: *mut CDslxCallGraph,
        index: i64,
    ) -> *mut CDslxFunction;

    pub fn xls_dslx_call_graph_get_callee_count(
        call_graph: *mut CDslxCallGraph,
        caller: *mut CDslxFunction,
    ) -> i64;

    pub fn xls_dslx_call_graph_get_callee_function(
        call_graph: *mut CDslxCallGraph,
        caller: *mut CDslxFunction,
        callee_index: i64,
    ) -> *mut CDslxFunction;

    pub fn xls_dslx_invocation_callee_data_array_free(array: *mut CDslxInvocationCalleeDataArray);
    pub fn xls_dslx_invocation_callee_data_array_get_count(
        array: *mut CDslxInvocationCalleeDataArray,
    ) -> i64;
    pub fn xls_dslx_invocation_callee_data_array_get(
        array: *mut CDslxInvocationCalleeDataArray,
        index: i64,
    ) -> *mut CDslxInvocationCalleeData;

    pub fn xls_dslx_invocation_callee_data_clone(
        data: *mut CDslxInvocationCalleeData,
    ) -> *mut CDslxInvocationCalleeData;
    pub fn xls_dslx_invocation_callee_data_free(data: *mut CDslxInvocationCalleeData);
    pub fn xls_dslx_invocation_callee_data_get_callee_bindings(
        data: *mut CDslxInvocationCalleeData,
    ) -> *const CDslxParametricEnv;
    pub fn xls_dslx_invocation_callee_data_get_caller_bindings(
        data: *mut CDslxInvocationCalleeData,
    ) -> *const CDslxParametricEnv;
    pub fn xls_dslx_invocation_callee_data_get_derived_type_info(
        data: *mut CDslxInvocationCalleeData,
    ) -> *mut CDslxTypeInfo;
    pub fn xls_dslx_invocation_callee_data_get_invocation(
        data: *mut CDslxInvocationCalleeData,
    ) -> *mut CDslxInvocation;

    pub fn xls_dslx_invocation_data_get_invocation(
        data: *mut CDslxInvocationData,
    ) -> *mut CDslxInvocation;
    pub fn xls_dslx_invocation_data_get_callee(
        data: *mut CDslxInvocationData,
    ) -> *mut CDslxFunction;
    pub fn xls_dslx_invocation_data_get_caller(
        data: *mut CDslxInvocationData,
    ) -> *mut CDslxFunction;

    // -- ConstantDef

    pub fn xls_dslx_constant_def_get_name(
        constant_def: *const CDslxConstantDef,
    ) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_constant_def_get_value(constant_def: *const CDslxConstantDef)
    -> *mut CDslxExpr;

    // -- TypeAlias

    pub fn xls_dslx_type_alias_get_identifier(
        type_alias: *const CDslxTypeAlias,
    ) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_type_alias_get_type_annotation(
        type_alias: *const CDslxTypeAlias,
    ) -> *mut CDslxTypeAnnotation;

    // -- TypeAnnotation

    pub fn xls_dslx_type_annotation_get_type_ref_type_annotation(
        type_annotation: *const CDslxTypeAnnotation,
    ) -> *mut CDslxTypeRefTypeAnnotation;
    pub fn xls_dslx_type_annotation_get_array_type_annotation(
        type_annotation: *const CDslxTypeAnnotation,
    ) -> *mut CDslxArrayTypeAnnotation;

    // -- ArrayTypeAnnotation

    pub fn xls_dslx_array_type_annotation_get_element_type(
        array_type_annotation: *const CDslxArrayTypeAnnotation,
    ) -> *mut CDslxTypeAnnotation;

    // -- TypeRef

    pub fn xls_dslx_type_ref_get_type_definition(
        type_ref: *const CDslxTypeRef,
    ) -> *mut CDslxTypeDefinition;

    // -- Import

    pub fn xls_dslx_import_get_subject_count(import: *const CDslxImport) -> i64;
    pub fn xls_dslx_import_get_subject(
        import: *const CDslxImport,
        i: i64,
    ) -> *mut std::os::raw::c_char;

    // -- ColonRef

    pub fn xls_dslx_colon_ref_resolve_import_subject(
        colon_ref: *const CDslxColonRef,
    ) -> *mut CDslxImport;

    // -- TypeDefinition

    pub fn xls_dslx_type_definition_get_colon_ref(
        type_definition: *const CDslxTypeDefinition,
    ) -> *mut CDslxColonRef;
    pub fn xls_dslx_type_definition_get_type_alias(
        type_definition: *const CDslxTypeDefinition,
    ) -> *mut CDslxTypeAlias;

    // -- TypeRefTypeAnnotation

    pub fn xls_dslx_type_ref_type_annotation_get_type_ref(
        type_ref_type_annotation: *const CDslxTypeRefTypeAnnotation,
    ) -> *mut CDslxTypeRef;
    pub fn xls_dslx_type_ref_type_annotation_get_parametric_count(
        type_ref_type_annotation: *const CDslxTypeRefTypeAnnotation,
    ) -> i64;
    pub fn xls_dslx_type_ref_type_annotation_get_parametric_expr(
        type_ref_type_annotation: *const CDslxTypeRefTypeAnnotation,
        index: i64,
    ) -> *mut CDslxExpr;

    // -- StructDef

    pub fn xls_dslx_struct_def_get_identifier(
        struct_def: *const CDslxStructDef,
    ) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_struct_def_is_parametric(struct_def: *const CDslxStructDef) -> bool;

    pub fn xls_dslx_struct_def_get_parametric_binding_count(
        struct_def: *const CDslxStructDef,
    ) -> i64;
    pub fn xls_dslx_struct_def_get_parametric_binding(
        struct_def: *const CDslxStructDef,
        index: i64,
    ) -> *mut CDslxParametricBinding;

    pub fn xls_dslx_struct_def_get_member_count(struct_def: *const CDslxStructDef) -> i64;

    pub fn xls_dslx_struct_def_get_member(
        struct_def: *const CDslxStructDef,
        i: i64,
    ) -> *mut CDslxStructMember;

    pub fn xls_dslx_struct_member_get_name(
        member: *const CDslxStructMember,
    ) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_struct_member_get_type(
        member: *const CDslxStructMember,
    ) -> *mut CDslxTypeAnnotation;

    // -- EnumDef

    pub fn xls_dslx_enum_def_get_identifier(
        enum_def: *const CDslxEnumDef,
    ) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_enum_def_get_member_count(enum_def: *const CDslxEnumDef) -> i64;

    pub fn xls_dslx_enum_def_get_member(
        enum_def: *const CDslxEnumDef,
        i: i64,
    ) -> *mut CDslxEnumMember;

    pub fn xls_dslx_enum_def_get_underlying(
        enum_def: *const CDslxEnumDef,
    ) -> *mut CDslxTypeAnnotation;

    pub fn xls_dslx_enum_member_get_name(
        member: *const CDslxEnumMember,
    ) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_enum_member_get_value(member: *const CDslxEnumMember) -> *mut CDslxExpr;

    // -- SumDef

    pub fn xls_dslx_sum_def_get_identifier(
        sum_def: *const CDslxSumDef,
    ) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_sum_def_is_parametric(sum_def: *const CDslxSumDef) -> bool;

    pub fn xls_dslx_sum_def_get_variant_count(sum_def: *const CDslxSumDef) -> i64;

    pub fn xls_dslx_expr_get_owner_module(expr: *mut CDslxExpr) -> *mut CDslxModule;

    // --

    pub fn xls_dslx_interp_value_free(value: *mut CDslxInterpValue);

    pub fn xls_dslx_interp_value_to_string(
        value: *mut CDslxInterpValue,
    ) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_interp_value_clone(value: *const CDslxInterpValue) -> *mut CDslxInterpValue;

    // Parametric env construction and InterpValue helpers
    pub fn xls_dslx_parametric_env_create(
        items: *const XlsDslxParametricEnvItem,
        items_count: libc::size_t,
        error_out: *mut *mut std::os::raw::c_char,
        env_out: *mut *mut CDslxParametricEnv,
    ) -> bool;
    pub fn xls_dslx_parametric_env_free(env: *mut CDslxParametricEnv);
    pub fn xls_dslx_parametric_env_clone(env: *const CDslxParametricEnv)
    -> *mut CDslxParametricEnv;
    pub fn xls_dslx_parametric_env_equals(
        lhs: *const CDslxParametricEnv,
        rhs: *const CDslxParametricEnv,
    ) -> bool;
    pub fn xls_dslx_parametric_env_less_than(
        lhs: *const CDslxParametricEnv,
        rhs: *const CDslxParametricEnv,
    ) -> bool;
    pub fn xls_dslx_parametric_env_hash(env: *const CDslxParametricEnv) -> u64;
    pub fn xls_dslx_parametric_env_to_string(
        env: *const CDslxParametricEnv,
    ) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_parametric_env_get_binding_count(env: *const CDslxParametricEnv) -> i64;
    pub fn xls_dslx_parametric_env_get_binding_identifier(
        env: *const CDslxParametricEnv,
        index: i64,
    ) -> *const std::os::raw::c_char;
    pub fn xls_dslx_parametric_env_get_binding_value(
        env: *const CDslxParametricEnv,
        index: i64,
    ) -> *mut CDslxInterpValue;

    pub fn xls_dslx_interp_value_make_ubits(bit_count: i64, value: u64) -> *mut CDslxInterpValue;
    pub fn xls_dslx_interp_value_make_sbits(bit_count: i64, value: i64) -> *mut CDslxInterpValue;
    pub fn xls_dslx_interp_value_make_enum(
        def: *mut CDslxEnumDef,
        is_signed: bool,
        bits: *const CIrBits,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CDslxInterpValue,
    ) -> bool;
    pub fn xls_dslx_interp_value_make_tuple(
        element_count: libc::size_t,
        elements: *mut *mut CDslxInterpValue,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CDslxInterpValue,
    ) -> bool;
    pub fn xls_dslx_interp_value_make_array(
        element_count: libc::size_t,
        elements: *mut *mut CDslxInterpValue,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CDslxInterpValue,
    ) -> bool;

    pub fn xls_dslx_interp_value_from_string(
        text: *const std::os::raw::c_char,
        dslx_stdlib_path: *const std::os::raw::c_char,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CDslxInterpValue,
    ) -> bool;

    pub fn xls_dslx_interp_value_convert_to_ir(
        value: *const CDslxInterpValue,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CIrValue,
    ) -> bool;

    pub fn xls_dslx_type_to_string(
        type_: *const CDslxType,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut std::os::raw::c_char,
    ) -> bool;

    // Stringification for DSLX AST nodes
    pub fn xls_dslx_function_to_string(function: *const CDslxFunction)
    -> *mut std::os::raw::c_char;
    pub fn xls_dslx_struct_def_to_string(
        struct_def: *const CDslxStructDef,
    ) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_enum_def_to_string(enum_def: *const CDslxEnumDef) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_sum_def_to_string(sum_def: *const CDslxSumDef) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_type_alias_to_string(
        type_alias: *const CDslxTypeAlias,
    ) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_constant_def_to_string(
        constant_def: *const CDslxConstantDef,
    ) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_quickcheck_to_string(qc: *const CDslxQuickcheck) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_expr_to_string(expr: *const CDslxExpr) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_type_info_get_const_expr(
        type_info: *mut CDslxTypeInfo,
        expr: *mut CDslxExpr,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut *mut CDslxInterpValue,
    ) -> bool;

    pub fn xls_dslx_type_get_total_bit_count(
        type_: *const CDslxType,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut i64,
    ) -> bool;

    pub fn xls_dslx_type_is_signed_bits(
        type_: *const CDslxType,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut bool,
    ) -> bool;

    pub fn xls_dslx_type_is_bits_like(
        type_: *const CDslxType,
        is_signed: *mut *mut CDslxTypeDim,
        size: *mut *mut CDslxTypeDim,
    ) -> bool;

    pub fn xls_dslx_type_is_enum(type_: *const CDslxType) -> bool;
    pub fn xls_dslx_type_is_struct(type_: *const CDslxType) -> bool;
    pub fn xls_dslx_type_is_array(type_: *const CDslxType) -> bool;

    pub fn xls_dslx_type_dim_is_parametric(dim: *const CDslxTypeDim) -> bool;
    pub fn xls_dslx_type_dim_get_as_bool(
        dim: *const CDslxTypeDim,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut bool,
    ) -> bool;
    pub fn xls_dslx_type_dim_get_as_int64(
        dim: *const CDslxTypeDim,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut i64,
    ) -> bool;
    pub fn xls_dslx_type_dim_free(dim: *mut CDslxTypeDim);

    pub fn xls_dslx_type_get_enum_def(ty: *const CDslxType) -> *mut CDslxEnumDef;

    pub fn xls_dslx_type_get_struct_def(ty: *const CDslxType) -> *mut CDslxStructDef;
    pub fn xls_dslx_type_struct_get_member_count(ty: *const CDslxType) -> i64;
    pub fn xls_dslx_type_struct_get_member_type(ty: *const CDslxType, index: i64)
    -> *mut CDslxType;

    pub fn xls_dslx_type_array_get_element_type(ty: *const CDslxType) -> *mut CDslxType;
    pub fn xls_dslx_type_array_get_size(ty: *const CDslxType) -> *mut CDslxTypeDim;

    // -- IR package and type APIs

    pub fn xls_package_create(name: *const std::os::raw::c_char) -> *mut CIrPackage;
    pub fn xls_package_get_bits_type(package: *mut CIrPackage, bit_count: i64) -> *mut CIrType;

    pub fn xls_package_get_tuple_type(
        package: *mut CIrPackage,
        members: *mut *mut CIrType,
        member_count: i64,
    ) -> *mut CIrType;

    pub fn xls_package_get_array_type(
        package: *mut CIrPackage,
        element_type: *mut CIrType,
        size: i64,
    ) -> *mut CIrType;

    pub fn xls_package_get_token_type(package: *mut CIrPackage) -> *mut CIrType;

    pub fn xls_function_type_get_param_count(fty: *mut CIrFunctionType) -> i64;

    pub fn xls_function_type_get_param_type(
        fty: *mut CIrFunctionType,
        index: libc::size_t,
        error_out: *mut *mut std::os::raw::c_char,
        param_type_out: *mut *mut CIrType,
    ) -> bool;

    pub fn xls_function_type_get_return_type(fty: *mut CIrFunctionType) -> *mut CIrType;

    pub fn xls_function_get_param_name(
        function: *mut CIrFunction,
        index: libc::size_t,
        error_out: *mut *mut std::os::raw::c_char,
        name_out: *mut *mut std::os::raw::c_char,
    ) -> bool;

    pub fn xls_dslx_function_is_parametric(function: *const CDslxFunction) -> bool;
    pub fn xls_dslx_function_is_public(function: *const CDslxFunction) -> bool;
    pub fn xls_dslx_function_get_identifier(
        function: *const CDslxFunction,
    ) -> *mut std::os::raw::c_char;

    pub fn xls_dslx_function_get_param_count(function: *const CDslxFunction) -> i64;
    pub fn xls_dslx_function_get_parametric_binding_count(function: *const CDslxFunction) -> i64;
    pub fn xls_dslx_function_get_param(
        function: *const CDslxFunction,
        index: i64,
    ) -> *mut CDslxParam;
    pub fn xls_dslx_function_get_parametric_binding(
        function: *const CDslxFunction,
        index: i64,
    ) -> *mut CDslxParametricBinding;
    pub fn xls_dslx_function_get_body(function: *const CDslxFunction) -> *mut CDslxExpr;
    // Returns the declared return type annotation node.
    // May return nullptr when the function omits an explicit return
    // annotation and relies on inferred return type.
    pub fn xls_dslx_function_get_return_type(
        function: *const CDslxFunction,
    ) -> *mut CDslxTypeAnnotation;
    pub fn xls_dslx_function_get_attribute_count(function: *const CDslxFunction) -> i64;
    pub fn xls_dslx_function_get_attribute(
        function: *const CDslxFunction,
        index: i64,
    ) -> *mut CDslxAttribute;
    pub fn xls_dslx_param_get_name(param: *const CDslxParam) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_param_get_type_annotation(param: *const CDslxParam)
    -> *mut CDslxTypeAnnotation;
    pub fn xls_dslx_attribute_get_kind(attribute: *const CDslxAttribute) -> DslxAttributeKind;
    pub fn xls_dslx_attribute_get_argument_count(attribute: *const CDslxAttribute) -> i64;
    pub fn xls_dslx_attribute_get_argument_kind(
        attribute: *const CDslxAttribute,
        index: i64,
    ) -> DslxAttributeArgumentKind;
    pub fn xls_dslx_attribute_get_string_argument(
        attribute: *const CDslxAttribute,
        index: i64,
    ) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_attribute_get_string_literal_argument(
        attribute: *const CDslxAttribute,
        index: i64,
    ) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_attribute_get_key_value_argument_key(
        attribute: *const CDslxAttribute,
        index: i64,
    ) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_attribute_get_key_value_string_argument_value(
        attribute: *const CDslxAttribute,
        index: i64,
    ) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_attribute_get_key_value_int_argument_value(
        attribute: *const CDslxAttribute,
        index: i64,
    ) -> i64;
    pub fn xls_dslx_attribute_to_string(
        attribute: *const CDslxAttribute,
    ) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_parametric_binding_get_identifier(
        binding: *const CDslxParametricBinding,
    ) -> *mut std::os::raw::c_char;
    pub fn xls_dslx_parametric_binding_get_type_annotation(
        binding: *const CDslxParametricBinding,
    ) -> *mut CDslxTypeAnnotation;
    pub fn xls_dslx_parametric_binding_get_expr(
        binding: *const CDslxParametricBinding,
    ) -> *mut CDslxExpr;
    pub fn xls_dslx_parametric_binding_get_default_generic_type(
        binding: *const CDslxParametricBinding,
    ) -> *mut CDslxTypeAnnotation;

    // -- "requires implicit token?" determination for a DSLX function
    pub fn xls_dslx_type_info_get_requires_implicit_token(
        type_info: *mut CDslxTypeInfo,
        function: *mut CDslxFunction,
        error_out: *mut *mut std::os::raw::c_char,
        result_out: *mut bool,
    ) -> bool;

    // -- Quickcheck APIs
    pub fn xls_dslx_quickcheck_get_function(qc: *const CDslxQuickcheck) -> *mut CDslxFunction;

    /// Returns true iff the Quickcheck has the `exhaustive` test-cases
    /// specifier.
    pub fn xls_dslx_quickcheck_is_exhaustive(qc: *const CDslxQuickcheck) -> bool;

    /// Retrieves the test-case count for the Quickcheck. Returns true and sets
    /// `*result_out` when the Quickcheck has a counted test-case specifier;
    /// returns false when the Quickcheck is marked exhaustive (in which case
    /// `*result_out` is not modified).
    pub fn xls_dslx_quickcheck_get_count(qc: *const CDslxQuickcheck, result_out: *mut i64) -> bool;
}

mod generated_artifact_paths {
    include!(concat!(env!("OUT_DIR"), "/artifact_paths.rs"));
}

pub const DSLX_STDLIB_PATH: &str = generated_artifact_paths::DSLX_STDLIB_PATH;

/// Path describing where the libxls shared library was materialized.
///
/// This value is a shared-library file path when the build uses explicit
/// artifact overrides, and a directory path when `xlsynth-sys` downloaded or
/// symlinked the DSO into its own output directory.
///
/// *** DO NOT USE THIS VARIABLE FROM WITHIN YOUR build.rs ***
///
/// You might be tempted to write the following in your build.rs:
///
/// ```ignore
/// // DO NOT DO THIS IN YOUR build.rs!!
/// let dylib_dirpath = xlsynth_sys::XLS_DSO_PATH;
/// // set rpath to dylib_dirpath or something.
/// ```
///
/// The problem is that build.rs is compiled for host, whereas if you're setting
/// an rpath (or something similar) you want to get the path from compiling
/// xlsynth_sys for *target*.  In other words, the above will break
/// cross-compilation.
///
/// Instead, your build.rs should get the path from an envvar which:
///
/// ```ignore
/// // Do this from your build.rs instead.
/// let dylib_path = std::env::var("DEP_XLSYNTH_DSO_PATH").unwrap();
/// ```
///
/// `DEP_XLSYNTH_DSO_PATH` follows the same contract as `XLS_DSO_PATH`: it is a
/// shared-library file path when `xlsynth-sys` uses explicit artifact
/// overrides, and a directory path when `xlsynth-sys` downloaded or symlinked
/// the DSO into its own output directory. Downstream `build.rs` code that needs
/// a directory for link-search or rpath setup should normalize a file path to
/// its parent directory before using it.
///
/// More details are available at
/// <https://doc.rust-lang.org/cargo/reference/build-script-examples.html#using-another-sys-crate>.
///
/// (If you use this envvar from your crate proper -- i.e. not from build.rs --
/// then it's perfectly fine.)
pub const XLS_DSO_PATH: &str = generated_artifact_paths::XLS_DSO_PATH;