File: 0004-Define-exported-cxx-symbols.patch

package info (click to toggle)
chromium 135.0.7049.95-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,959,392 kB
  • sloc: cpp: 34,198,526; ansic: 7,100,035; javascript: 3,985,800; python: 1,395,489; asm: 896,754; xml: 722,891; pascal: 180,504; sh: 94,909; perl: 88,388; objc: 79,739; sql: 53,020; cs: 41,358; fortran: 24,137; makefile: 22,501; php: 13,699; tcl: 10,142; yacc: 8,822; ruby: 7,350; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; awk: 197; sed: 36
file content (867 lines) | stat: -rw-r--r-- 40,026 bytes parent folder | download
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
From 73844b580d37a74ce57f32eee3087b251e1505ad Mon Sep 17 00:00:00 2001
From: "Dustin J. Mitchell" <djmitche@chromium.org>
Date: Mon, 10 Feb 2025 19:54:42 +0000
Subject: [PATCH] patch 4

---
 .../vendor/cxx-1.0.140/src/cxx.cc             | 327 ++++++++++--------
 1 file changed, 176 insertions(+), 151 deletions(-)

diff --git a/third_party/rust/chromium_crates_io/vendor/cxx-1.0.140/src/cxx.cc b/third_party/rust/chromium_crates_io/vendor/cxx-1.0.140/src/cxx.cc
index 5741afa229129..1d75716d2cba6 100644
--- a/third_party/rust/chromium_crates_io/vendor/cxx-1.0.140/src/cxx.cc
+++ b/third_party/rust/chromium_crates_io/vendor/cxx-1.0.140/src/cxx.cc
@@ -1,79 +1,101 @@
 #include "third_party/rust/cxx/v1/cxx.h"
 #include <cstdio>
 #include <cstring>
 #include <iostream>
 #include <memory>
 
+#ifndef CXX_RS_EXPORT
+#define CXX_RS_EXPORT
+#endif
+#ifndef CXX_CPP_EXPORT
+#define CXX_CPP_EXPORT
+#endif
+
 extern "C" {
-void cxxbridge1$cxx_string$init(std::string *s, const std::uint8_t *ptr,
-                                std::size_t len) noexcept {
+CXX_RS_EXPORT void cxxbridge1$cxx_string$init(std::string *s,
+                                              const std::uint8_t *ptr,
+                                              std::size_t len) noexcept {
   new (s) std::string(reinterpret_cast<const char *>(ptr), len);
 }
 
-void cxxbridge1$cxx_string$destroy(std::string *s) noexcept {
+CXX_RS_EXPORT void cxxbridge1$cxx_string$destroy(std::string *s) noexcept {
   using std::string;
   s->~string();
 }
 
-const char *cxxbridge1$cxx_string$data(const std::string &s) noexcept {
+CXX_RS_EXPORT const char *
+cxxbridge1$cxx_string$data(const std::string &s) noexcept {
   return s.data();
 }
 
-std::size_t cxxbridge1$cxx_string$length(const std::string &s) noexcept {
+CXX_RS_EXPORT std::size_t
+cxxbridge1$cxx_string$length(const std::string &s) noexcept {
   return s.length();
 }
 
-void cxxbridge1$cxx_string$clear(std::string &s) noexcept { s.clear(); }
+CXX_RS_EXPORT void cxxbridge1$cxx_string$clear(std::string &s) noexcept {
+  s.clear();
+}
 
-void cxxbridge1$cxx_string$reserve_total(std::string &s,
-                                         size_t new_cap) noexcept {
+CXX_RS_EXPORT void
+cxxbridge1$cxx_string$reserve_total(std::string &s, size_t new_cap) noexcept {
   s.reserve(new_cap);
 }
 
-void cxxbridge1$cxx_string$push(std::string &s, const std::uint8_t *ptr,
-                                std::size_t len) noexcept {
+CXX_RS_EXPORT void cxxbridge1$cxx_string$push(std::string &s,
+                                              const std::uint8_t *ptr,
+                                              std::size_t len) noexcept {
   s.append(reinterpret_cast<const char *>(ptr), len);
 }
 
 // rust::String
-void cxxbridge1$string$new(rust::String *self) noexcept;
-void cxxbridge1$string$clone(rust::String *self,
-                             const rust::String &other) noexcept;
-bool cxxbridge1$string$from_utf8(rust::String *self, const char *ptr,
-                                 std::size_t len) noexcept;
-void cxxbridge1$string$from_utf8_lossy(rust::String *self, const char *ptr,
-                                       std::size_t len) noexcept;
-bool cxxbridge1$string$from_utf16(rust::String *self, const char16_t *ptr,
-                                  std::size_t len) noexcept;
-void cxxbridge1$string$from_utf16_lossy(rust::String *self, const char16_t *ptr,
-                                        std::size_t len) noexcept;
-void cxxbridge1$string$drop(rust::String *self) noexcept;
-const char *cxxbridge1$string$ptr(const rust::String *self) noexcept;
-std::size_t cxxbridge1$string$len(const rust::String *self) noexcept;
-std::size_t cxxbridge1$string$capacity(const rust::String *self) noexcept;
-void cxxbridge1$string$reserve_additional(rust::String *self,
-                                          size_t additional) noexcept;
-void cxxbridge1$string$reserve_total(rust::String *self,
-                                     size_t new_cap) noexcept;
+CXX_RS_EXPORT void cxxbridge1$string$new(rust::String *self) noexcept;
+CXX_RS_EXPORT void cxxbridge1$string$clone(rust::String *self,
+                                           const rust::String &other) noexcept;
+CXX_RS_EXPORT bool cxxbridge1$string$from_utf8(rust::String *self,
+                                               const char *ptr,
+                                               std::size_t len) noexcept;
+CXX_RS_EXPORT void cxxbridge1$string$from_utf8_lossy(rust::String *self,
+                                                     const char *ptr,
+                                                     std::size_t len) noexcept;
+CXX_RS_EXPORT bool cxxbridge1$string$from_utf16(rust::String *self,
+                                                const char16_t *ptr,
+                                                std::size_t len) noexcept;
+CXX_RS_EXPORT void cxxbridge1$string$from_utf16_lossy(rust::String *self,
+                                                      const char16_t *ptr,
+                                                      std::size_t len) noexcept;
+CXX_RS_EXPORT void cxxbridge1$string$drop(rust::String *self) noexcept;
+CXX_RS_EXPORT const char *
+cxxbridge1$string$ptr(const rust::String *self) noexcept;
+CXX_RS_EXPORT std::size_t
+cxxbridge1$string$len(const rust::String *self) noexcept;
+CXX_RS_EXPORT std::size_t
+cxxbridge1$string$capacity(const rust::String *self) noexcept;
+CXX_RS_EXPORT void
+cxxbridge1$string$reserve_additional(rust::String *self,
+                                     size_t additional) noexcept;
+CXX_RS_EXPORT void cxxbridge1$string$reserve_total(rust::String *self,
+                                                   size_t new_cap) noexcept;
 
 // rust::Str
-void cxxbridge1$str$new(rust::Str *self) noexcept;
-void cxxbridge1$str$ref(rust::Str *self, const rust::String *string) noexcept;
-bool cxxbridge1$str$from(rust::Str *self, const char *ptr,
-                         std::size_t len) noexcept;
-const char *cxxbridge1$str$ptr(const rust::Str *self) noexcept;
-std::size_t cxxbridge1$str$len(const rust::Str *self) noexcept;
+CXX_RS_EXPORT void cxxbridge1$str$new(rust::Str *self) noexcept;
+CXX_RS_EXPORT void cxxbridge1$str$ref(rust::Str *self,
+                                      const rust::String *string) noexcept;
+CXX_RS_EXPORT bool cxxbridge1$str$from(rust::Str *self, const char *ptr,
+                                       std::size_t len) noexcept;
+CXX_RS_EXPORT const char *cxxbridge1$str$ptr(const rust::Str *self) noexcept;
+CXX_RS_EXPORT std::size_t cxxbridge1$str$len(const rust::Str *self) noexcept;
 
 // rust::Slice
-void cxxbridge1$slice$new(void *self, const void *ptr,
-                          std::size_t len) noexcept;
-void *cxxbridge1$slice$ptr(const void *self) noexcept;
-std::size_t cxxbridge1$slice$len(const void *self) noexcept;
+CXX_RS_EXPORT void cxxbridge1$slice$new(void *self, const void *ptr,
+                                        std::size_t len) noexcept;
+CXX_RS_EXPORT void *cxxbridge1$slice$ptr(const void *self) noexcept;
+CXX_RS_EXPORT std::size_t cxxbridge1$slice$len(const void *self) noexcept;
 } // extern "C"
 
 namespace rust {
 inline namespace cxxbridge1 {
 
 template <typename Exception>
 void panic [[noreturn]] (const char *msg) {
 #if defined(RUST_CXX_NO_EXCEPTIONS)
@@ -81,323 +103,324 @@ void panic [[noreturn]] (const char *msg) {
   std::abort();
 #else
   throw Exception(msg);
 #endif
 }
 
 template void panic<std::out_of_range> [[noreturn]] (const char *msg);
 
+
 template <typename T>
 static bool is_aligned(const void *ptr) noexcept {
   auto iptr = reinterpret_cast<std::uintptr_t>(ptr);
   return !(iptr % alignof(T));
 }
 
-String::String() noexcept { cxxbridge1$string$new(this); }
+CXX_CPP_EXPORT String::String() noexcept { cxxbridge1$string$new(this); }
 
-String::String(const String &other) noexcept {
+CXX_CPP_EXPORT String::String(const String &other) noexcept {
   cxxbridge1$string$clone(this, other);
 }
 
-String::String(String &&other) noexcept : repr(other.repr) {
+CXX_CPP_EXPORT String::String(String &&other) noexcept : repr(other.repr) {
   cxxbridge1$string$new(&other);
 }
 
-String::~String() noexcept { cxxbridge1$string$drop(this); }
+CXX_CPP_EXPORT String::~String() noexcept { cxxbridge1$string$drop(this); }
 
 static void initString(String *self, const char *s, std::size_t len) {
   if (!cxxbridge1$string$from_utf8(self, s, len)) {
     panic<std::invalid_argument>("data for rust::String is not utf-8");
   }
 }
 
 static void initString(String *self, const char16_t *s, std::size_t len) {
   if (!cxxbridge1$string$from_utf16(self, s, len)) {
     panic<std::invalid_argument>("data for rust::String is not utf-16");
   }
 }
 
-String::String(const std::string &s) { initString(this, s.data(), s.length()); }
+CXX_CPP_EXPORT String::String(const std::string &s) { initString(this, s.data(), s.length()); }
 
-String::String(const char *s) {
+CXX_CPP_EXPORT String::String(const char *s) {
   assert(s != nullptr);
   initString(this, s, std::strlen(s));
 }
 
-String::String(const char *s, std::size_t len) {
+CXX_CPP_EXPORT String::String(const char *s, std::size_t len) {
   assert(s != nullptr || len == 0);
   initString(this,
              s == nullptr && len == 0 ? reinterpret_cast<const char *>(1) : s,
              len);
 }
 
 #if __cplusplus >= 202002L
-String::String(const char8_t *s) : String(reinterpret_cast<const char *>(s)) {}
+CXX_CPP_EXPORT String::String(const char8_t *s) : String(reinterpret_cast<const char *>(s)) {}
 
-String::String(const char8_t *s, std::size_t len)
+CXX_CPP_EXPORT String::String(const char8_t *s, std::size_t len)
     : String(reinterpret_cast<const char *>(s), len) {}
 #endif
 
-String::String(const char16_t *s) {
+CXX_CPP_EXPORT String::String(const char16_t *s) {
   assert(s != nullptr);
   assert(is_aligned<char16_t>(s));
   initString(this, s, std::char_traits<char16_t>::length(s));
 }
 
-String::String(const char16_t *s, std::size_t len) {
+CXX_CPP_EXPORT String::String(const char16_t *s, std::size_t len) {
   assert(s != nullptr || len == 0);
   assert(is_aligned<char16_t>(s));
   initString(this,
              s == nullptr && len == 0 ? reinterpret_cast<const char16_t *>(2)
                                       : s,
              len);
 }
 
 struct String::lossy_t {};
 
-String::String(lossy_t, const char *s, std::size_t len) noexcept {
+CXX_CPP_EXPORT String::String(lossy_t, const char *s, std::size_t len) noexcept {
   cxxbridge1$string$from_utf8_lossy(
       this, s == nullptr && len == 0 ? reinterpret_cast<const char *>(1) : s,
       len);
 }
 
-String::String(lossy_t, const char16_t *s, std::size_t len) noexcept {
+CXX_CPP_EXPORT String::String(lossy_t, const char16_t *s, std::size_t len) noexcept {
   cxxbridge1$string$from_utf16_lossy(
       this,
       s == nullptr && len == 0 ? reinterpret_cast<const char16_t *>(2) : s,
       len);
 }
 
-String String::lossy(const std::string &s) noexcept {
+CXX_CPP_EXPORT String String::lossy(const std::string &s) noexcept {
   return String::lossy(s.data(), s.length());
 }
 
-String String::lossy(const char *s) noexcept {
+CXX_CPP_EXPORT String String::lossy(const char *s) noexcept {
   assert(s != nullptr);
   return String::lossy(s, std::strlen(s));
 }
 
-String String::lossy(const char *s, std::size_t len) noexcept {
+CXX_CPP_EXPORT String String::lossy(const char *s, std::size_t len) noexcept {
   assert(s != nullptr || len == 0);
   return String(lossy_t{}, s, len);
 }
 
-String String::lossy(const char16_t *s) noexcept {
+CXX_CPP_EXPORT String String::lossy(const char16_t *s) noexcept {
   assert(s != nullptr);
   assert(is_aligned<char16_t>(s));
   return String(lossy_t{}, s, std::char_traits<char16_t>::length(s));
 }
 
-String String::lossy(const char16_t *s, std::size_t len) noexcept {
+CXX_CPP_EXPORT String String::lossy(const char16_t *s, std::size_t len) noexcept {
   assert(s != nullptr || len == 0);
   assert(is_aligned<char16_t>(s));
   return String(lossy_t{}, s, len);
 }
 
-String &String::operator=(const String &other) & noexcept {
+CXX_CPP_EXPORT String &String::operator=(const String &other) & noexcept {
   if (this != &other) {
     cxxbridge1$string$drop(this);
     cxxbridge1$string$clone(this, other);
   }
   return *this;
 }
 
-String &String::operator=(String &&other) & noexcept {
+CXX_CPP_EXPORT String &String::operator=(String &&other) & noexcept {
   cxxbridge1$string$drop(this);
   this->repr = other.repr;
   cxxbridge1$string$new(&other);
   return *this;
 }
 
-String::operator std::string() const {
+CXX_CPP_EXPORT String::operator std::string() const {
   return std::string(this->data(), this->size());
 }
 
-const char *String::data() const noexcept {
+CXX_CPP_EXPORT const char *String::data() const noexcept {
   return cxxbridge1$string$ptr(this);
 }
 
-std::size_t String::size() const noexcept {
+CXX_CPP_EXPORT std::size_t String::size() const noexcept {
   return cxxbridge1$string$len(this);
 }
 
-std::size_t String::length() const noexcept {
+CXX_CPP_EXPORT std::size_t String::length() const noexcept {
   return cxxbridge1$string$len(this);
 }
 
-bool String::empty() const noexcept { return this->size() == 0; }
+CXX_CPP_EXPORT bool String::empty() const noexcept { return this->size() == 0; }
 
-const char *String::c_str() noexcept {
+CXX_CPP_EXPORT const char *String::c_str() noexcept {
   auto len = this->length();
   cxxbridge1$string$reserve_additional(this, 1);
   auto ptr = this->data();
   const_cast<char *>(ptr)[len] = '\0';
   return ptr;
 }
 
-std::size_t String::capacity() const noexcept {
+CXX_CPP_EXPORT std::size_t String::capacity() const noexcept {
   return cxxbridge1$string$capacity(this);
 }
 
-void String::reserve(std::size_t new_cap) noexcept {
+CXX_CPP_EXPORT void String::reserve(std::size_t new_cap) noexcept {
   cxxbridge1$string$reserve_total(this, new_cap);
 }
 
-String::iterator String::begin() noexcept {
+CXX_CPP_EXPORT String::iterator String::begin() noexcept {
   return const_cast<char *>(this->data());
 }
 
-String::iterator String::end() noexcept {
+CXX_CPP_EXPORT String::iterator String::end() noexcept {
   return const_cast<char *>(this->data()) + this->size();
 }
 
-String::const_iterator String::begin() const noexcept { return this->cbegin(); }
+CXX_CPP_EXPORT String::const_iterator String::begin() const noexcept { return this->cbegin(); }
 
-String::const_iterator String::end() const noexcept { return this->cend(); }
+CXX_CPP_EXPORT String::const_iterator String::end() const noexcept { return this->cend(); }
 
-String::const_iterator String::cbegin() const noexcept { return this->data(); }
+CXX_CPP_EXPORT String::const_iterator String::cbegin() const noexcept { return this->data(); }
 
-String::const_iterator String::cend() const noexcept {
+CXX_CPP_EXPORT String::const_iterator String::cend() const noexcept {
   return this->data() + this->size();
 }
 
-bool String::operator==(const String &rhs) const noexcept {
+CXX_CPP_EXPORT bool String::operator==(const String &rhs) const noexcept {
   return rust::Str(*this) == rust::Str(rhs);
 }
 
-bool String::operator!=(const String &rhs) const noexcept {
+CXX_CPP_EXPORT bool String::operator!=(const String &rhs) const noexcept {
   return rust::Str(*this) != rust::Str(rhs);
 }
 
-bool String::operator<(const String &rhs) const noexcept {
+CXX_CPP_EXPORT bool String::operator<(const String &rhs) const noexcept {
   return rust::Str(*this) < rust::Str(rhs);
 }
 
-bool String::operator<=(const String &rhs) const noexcept {
+CXX_CPP_EXPORT bool String::operator<=(const String &rhs) const noexcept {
   return rust::Str(*this) <= rust::Str(rhs);
 }
 
-bool String::operator>(const String &rhs) const noexcept {
+CXX_CPP_EXPORT bool String::operator>(const String &rhs) const noexcept {
   return rust::Str(*this) > rust::Str(rhs);
 }
 
-bool String::operator>=(const String &rhs) const noexcept {
+CXX_CPP_EXPORT bool String::operator>=(const String &rhs) const noexcept {
   return rust::Str(*this) >= rust::Str(rhs);
 }
 
-void String::swap(String &rhs) noexcept {
+CXX_CPP_EXPORT void String::swap(String &rhs) noexcept {
   using std::swap;
   swap(this->repr, rhs.repr);
 }
 
-String::String(unsafe_bitcopy_t, const String &bits) noexcept
+CXX_CPP_EXPORT String::String(unsafe_bitcopy_t, const String &bits) noexcept
     : repr(bits.repr) {}
 
-std::ostream &operator<<(std::ostream &os, const String &s) {
+CXX_CPP_EXPORT std::ostream &operator<<(std::ostream &os, const String &s) {
   os.write(s.data(), static_cast<std::streamsize>(s.size()));
   return os;
 }
 
-Str::Str() noexcept { cxxbridge1$str$new(this); }
+CXX_CPP_EXPORT Str::Str() noexcept { cxxbridge1$str$new(this); }
 
-Str::Str(const String &s) noexcept { cxxbridge1$str$ref(this, &s); }
+CXX_CPP_EXPORT Str::Str(const String &s) noexcept { cxxbridge1$str$ref(this, &s); }
 
 static void initStr(Str *self, const char *ptr, std::size_t len) {
   if (!cxxbridge1$str$from(self, ptr, len)) {
     panic<std::invalid_argument>("data for rust::Str is not utf-8");
   }
 }
 
-Str::Str(const std::string &s) { initStr(this, s.data(), s.length()); }
+CXX_CPP_EXPORT Str::Str(const std::string &s) { initStr(this, s.data(), s.length()); }
 
-Str::Str(const char *s) {
+CXX_CPP_EXPORT Str::Str(const char *s) {
   assert(s != nullptr);
   initStr(this, s, std::strlen(s));
 }
 
-Str::Str(const char *s, std::size_t len) {
+CXX_CPP_EXPORT Str::Str(const char *s, std::size_t len) {
   assert(s != nullptr || len == 0);
   initStr(this,
           s == nullptr && len == 0 ? reinterpret_cast<const char *>(1) : s,
           len);
 }
 
-Str::operator std::string() const {
+CXX_CPP_EXPORT Str::operator std::string() const {
   return std::string(this->data(), this->size());
 }
 
-const char *Str::data() const noexcept { return cxxbridge1$str$ptr(this); }
+CXX_CPP_EXPORT const char *Str::data() const noexcept { return cxxbridge1$str$ptr(this); }
 
-std::size_t Str::size() const noexcept { return cxxbridge1$str$len(this); }
+CXX_CPP_EXPORT std::size_t Str::size() const noexcept { return cxxbridge1$str$len(this); }
 
-std::size_t Str::length() const noexcept { return this->size(); }
+CXX_CPP_EXPORT std::size_t Str::length() const noexcept { return this->size(); }
 
-bool Str::empty() const noexcept { return this->size() == 0; }
+CXX_CPP_EXPORT bool Str::empty() const noexcept { return this->size() == 0; }
 
-Str::const_iterator Str::begin() const noexcept { return this->cbegin(); }
+CXX_CPP_EXPORT Str::const_iterator Str::begin() const noexcept { return this->cbegin(); }
 
-Str::const_iterator Str::end() const noexcept { return this->cend(); }
+CXX_CPP_EXPORT Str::const_iterator Str::end() const noexcept { return this->cend(); }
 
-Str::const_iterator Str::cbegin() const noexcept { return this->data(); }
+CXX_CPP_EXPORT Str::const_iterator Str::cbegin() const noexcept { return this->data(); }
 
-Str::const_iterator Str::cend() const noexcept {
+CXX_CPP_EXPORT Str::const_iterator Str::cend() const noexcept {
   return this->data() + this->size();
 }
 
-bool Str::operator==(const Str &rhs) const noexcept {
+CXX_CPP_EXPORT bool Str::operator==(const Str &rhs) const noexcept {
   return this->size() == rhs.size() &&
          std::equal(this->begin(), this->end(), rhs.begin());
 }
 
-bool Str::operator!=(const Str &rhs) const noexcept { return !(*this == rhs); }
+CXX_CPP_EXPORT bool Str::operator!=(const Str &rhs) const noexcept { return !(*this == rhs); }
 
-bool Str::operator<(const Str &rhs) const noexcept {
+CXX_CPP_EXPORT bool Str::operator<(const Str &rhs) const noexcept {
   return std::lexicographical_compare(this->begin(), this->end(), rhs.begin(),
                                       rhs.end());
 }
 
-bool Str::operator<=(const Str &rhs) const noexcept {
+CXX_CPP_EXPORT bool Str::operator<=(const Str &rhs) const noexcept {
   // std::mismatch(this->begin(), this->end(), rhs.begin(), rhs.end()), except
   // without Undefined Behavior on C++11 if rhs is shorter than *this.
   const_iterator liter = this->begin(), lend = this->end(), riter = rhs.begin(),
                  rend = rhs.end();
   while (liter != lend && riter != rend && *liter == *riter) {
     ++liter, ++riter;
   }
   if (liter == lend) {
     return true; // equal or *this is a prefix of rhs
   } else if (riter == rend) {
     return false; // rhs is a prefix of *this
   } else {
     return *liter <= *riter;
   }
 }
 
-bool Str::operator>(const Str &rhs) const noexcept { return rhs < *this; }
+CXX_CPP_EXPORT bool Str::operator>(const Str &rhs) const noexcept { return rhs < *this; }
 
-bool Str::operator>=(const Str &rhs) const noexcept { return rhs <= *this; }
+CXX_CPP_EXPORT bool Str::operator>=(const Str &rhs) const noexcept { return rhs <= *this; }
 
-void Str::swap(Str &rhs) noexcept {
+CXX_CPP_EXPORT void Str::swap(Str &rhs) noexcept {
   using std::swap;
   swap(this->repr, rhs.repr);
 }
 
-std::ostream &operator<<(std::ostream &os, const Str &s) {
+CXX_CPP_EXPORT std::ostream &operator<<(std::ostream &os, const Str &s) {
   os.write(s.data(), static_cast<std::streamsize>(s.size()));
   return os;
 }
 
-void sliceInit(void *self, const void *ptr, std::size_t len) noexcept {
+CXX_CPP_EXPORT void sliceInit(void *self, const void *ptr, std::size_t len) noexcept {
   cxxbridge1$slice$new(self, ptr, len);
 }
 
-void *slicePtr(const void *self) noexcept { return cxxbridge1$slice$ptr(self); }
+CXX_CPP_EXPORT void *slicePtr(const void *self) noexcept { return cxxbridge1$slice$ptr(self); }
 
-std::size_t sliceLen(const void *self) noexcept {
+CXX_CPP_EXPORT std::size_t sliceLen(const void *self) noexcept {
   return cxxbridge1$slice$len(self);
 }
 
 // Rust specifies that usize is ABI compatible with C's uintptr_t.
 // https://rust-lang.github.io/unsafe-code-guidelines/layout/scalars.html#isize-and-usize
 // However there is no direct Rust equivalent for size_t. C does not guarantee
 // that size_t and uintptr_t are compatible. In practice though, on all
 // platforms supported by Rust, they are identical for ABI purposes. See the
@@ -458,58 +481,59 @@ static_assert(!std::is_same<Vec<std::uint8_t>::const_iterator,
 
 static const char *errorCopy(const char *ptr, std::size_t len) {
   char *copy = new char[len];
   std::memcpy(copy, ptr, len);
   return copy;
 }
 
 extern "C" {
-const char *cxxbridge1$error(const char *ptr, std::size_t len) noexcept {
+CXX_RS_EXPORT const char *cxxbridge1$error(const char *ptr,
+                                           std::size_t len) noexcept {
   return errorCopy(ptr, len);
 }
 } // extern "C"
 
-Error::Error(const Error &other)
+CXX_CPP_EXPORT Error::Error(const Error &other)
     : std::exception(other),
       msg(other.msg ? errorCopy(other.msg, other.len) : nullptr),
       len(other.len) {}
 
-Error::Error(Error &&other) noexcept
+CXX_CPP_EXPORT Error::Error(Error &&other) noexcept
     : std::exception(std::move(other)), msg(other.msg), len(other.len) {
   other.msg = nullptr;
   other.len = 0;
 }
 
-Error::~Error() noexcept { delete[] this->msg; }
+CXX_CPP_EXPORT Error::~Error() noexcept { delete[] this->msg; }
 
-Error &Error::operator=(const Error &other) & {
+CXX_CPP_EXPORT Error &Error::operator=(const Error &other) & {
   if (this != &other) {
     std::exception::operator=(other);
     delete[] this->msg;
     this->msg = nullptr;
     if (other.msg) {
       this->msg = errorCopy(other.msg, other.len);
       this->len = other.len;
     }
   }
   return *this;
 }
 
-Error &Error::operator=(Error &&other) & noexcept {
+CXX_CPP_EXPORT Error &Error::operator=(Error &&other) & noexcept {
   std::exception::operator=(std::move(other));
   delete[] this->msg;
   this->msg = other.msg;
   this->len = other.len;
   other.msg = nullptr;
   other.len = 0;
   return *this;
 }
 
-const char *Error::what() const noexcept { return this->msg; }
+CXX_CPP_EXPORT const char *Error::what() const noexcept { return this->msg; }
 
 namespace {
 template <typename T>
 union MaybeUninit {
   T value;
   MaybeUninit() {}
   ~MaybeUninit() {}
 };
@@ -518,17 +542,17 @@ union MaybeUninit {
 namespace repr {
 struct PtrLen final {
   void *ptr;
   std::size_t len;
 };
 } // namespace repr
 
 extern "C" {
-repr::PtrLen cxxbridge1$exception(const char *, std::size_t len) noexcept;
+CXX_RS_EXPORT repr::PtrLen cxxbridge1$exception(const char *, std::size_t len) noexcept;
 }
 
 namespace detail {
 // On some platforms size_t is the same C++ type as one of the sized integer
 // types; on others it is a distinct type. Only in the latter case do we need to
 // define a specialized impl of rust::Vec<size_t>, because in the former case it
 // would collide with one of the other specializations.
 using usize_if_unique =
@@ -549,130 +573,131 @@ class Fail final {
   repr::PtrLen &throw$;
 
 public:
   Fail(repr::PtrLen &throw$) noexcept : throw$(throw$) {}
   void operator()(const char *) noexcept;
   void operator()(const std::string &) noexcept;
 };
 
-void Fail::operator()(const char *catch$) noexcept {
+CXX_CPP_EXPORT void Fail::operator()(const char *catch$) noexcept {
   throw$ = cxxbridge1$exception(catch$, std::strlen(catch$));
 }
 
-void Fail::operator()(const std::string &catch$) noexcept {
+CXX_CPP_EXPORT void Fail::operator()(const std::string &catch$) noexcept {
   throw$ = cxxbridge1$exception(catch$.data(), catch$.length());
 }
 } // namespace detail
 
 } // namespace cxxbridge1
 } // namespace rust
 
 namespace {
 template <typename T>
 void destroy(T *ptr) {
   ptr->~T();
 }
 } // namespace
 
 extern "C" {
-void cxxbridge1$unique_ptr$std$string$null(
+CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$string$null(
     std::unique_ptr<std::string> *ptr) noexcept {
   new (ptr) std::unique_ptr<std::string>();
 }
-void cxxbridge1$unique_ptr$std$string$raw(std::unique_ptr<std::string> *ptr,
-                                          std::string *raw) noexcept {
+CXX_RS_EXPORT void
+cxxbridge1$unique_ptr$std$string$raw(std::unique_ptr<std::string> *ptr,
+                                     std::string *raw) noexcept {
   new (ptr) std::unique_ptr<std::string>(raw);
 }
-const std::string *cxxbridge1$unique_ptr$std$string$get(
+CXX_RS_EXPORT const std::string *cxxbridge1$unique_ptr$std$string$get(
     const std::unique_ptr<std::string> &ptr) noexcept {
   return ptr.get();
 }
-std::string *cxxbridge1$unique_ptr$std$string$release(
+CXX_RS_EXPORT std::string *cxxbridge1$unique_ptr$std$string$release(
     std::unique_ptr<std::string> &ptr) noexcept {
   return ptr.release();
 }
-void cxxbridge1$unique_ptr$std$string$drop(
+CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$string$drop(
     std::unique_ptr<std::string> *ptr) noexcept {
   ptr->~unique_ptr();
 }
 } // extern "C"
 
 namespace {
 const std::size_t kMaxExpectedWordsInString = 8;
 static_assert(alignof(std::string) <= alignof(void *),
               "unexpectedly large std::string alignment");
 static_assert(sizeof(std::string) <= kMaxExpectedWordsInString * sizeof(void *),
               "unexpectedly large std::string size");
 } // namespace
 
 #define STD_VECTOR_OPS(RUST_TYPE, CXX_TYPE)                                    \
-  std::vector<CXX_TYPE> *cxxbridge1$std$vector$##RUST_TYPE##$new() noexcept {  \
+  CXX_RS_EXPORT std::vector<CXX_TYPE> *cxxbridge1$std$vector$##RUST_TYPE##$new() noexcept {  \
     return new std::vector<CXX_TYPE>();                                        \
   }                                                                            \
-  std::size_t cxxbridge1$std$vector$##RUST_TYPE##$size(                        \
+  CXX_RS_EXPORT std::size_t cxxbridge1$std$vector$##RUST_TYPE##$size(                        \
       const std::vector<CXX_TYPE> &s) noexcept {                               \
     return s.size();                                                           \
   }                                                                            \
-  CXX_TYPE *cxxbridge1$std$vector$##RUST_TYPE##$get_unchecked(                 \
+  CXX_RS_EXPORT CXX_TYPE *cxxbridge1$std$vector$##RUST_TYPE##$get_unchecked(                 \
       std::vector<CXX_TYPE> *s, std::size_t pos) noexcept {                    \
     return &(*s)[pos];                                                         \
   }                                                                            \
-  void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$null(                    \
+  CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$null(                    \
       std::unique_ptr<std::vector<CXX_TYPE>> *ptr) noexcept {                  \
     new (ptr) std::unique_ptr<std::vector<CXX_TYPE>>();                        \
   }                                                                            \
-  void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$raw(                     \
+  CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$raw(                     \
       std::unique_ptr<std::vector<CXX_TYPE>> *ptr,                             \
       std::vector<CXX_TYPE> *raw) noexcept {                                   \
     new (ptr) std::unique_ptr<std::vector<CXX_TYPE>>(raw);                     \
   }                                                                            \
-  const std::vector<CXX_TYPE>                                                  \
+  CXX_RS_EXPORT const std::vector<CXX_TYPE>                                                  \
       *cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$get(                     \
           const std::unique_ptr<std::vector<CXX_TYPE>> &ptr) noexcept {        \
     return ptr.get();                                                          \
   }                                                                            \
-  std::vector<CXX_TYPE>                                                        \
+  CXX_RS_EXPORT std::vector<CXX_TYPE>                                                        \
       *cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$release(                 \
           std::unique_ptr<std::vector<CXX_TYPE>> &ptr) noexcept {              \
     return ptr.release();                                                      \
   }                                                                            \
-  void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$drop(                    \
+  CXX_RS_EXPORT void cxxbridge1$unique_ptr$std$vector$##RUST_TYPE##$drop(                    \
       std::unique_ptr<std::vector<CXX_TYPE>> *ptr) noexcept {                  \
     ptr->~unique_ptr();                                                        \
   }
 
 #define STD_VECTOR_TRIVIAL_OPS(RUST_TYPE, CXX_TYPE)                            \
-  void cxxbridge1$std$vector$##RUST_TYPE##$push_back(                          \
+  CXX_RS_EXPORT void cxxbridge1$std$vector$##RUST_TYPE##$push_back(                          \
       std::vector<CXX_TYPE> *v, CXX_TYPE *value) noexcept {                    \
     v->push_back(std::move(*value));                                           \
     destroy(value);                                                            \
   }                                                                            \
-  void cxxbridge1$std$vector$##RUST_TYPE##$pop_back(std::vector<CXX_TYPE> *v,  \
+  CXX_RS_EXPORT void cxxbridge1$std$vector$##RUST_TYPE##$pop_back(std::vector<CXX_TYPE> *v,  \
                                                     CXX_TYPE *out) noexcept {  \
     new (out) CXX_TYPE(std::move(v->back()));                                  \
     v->pop_back();                                                             \
   }
 
 #define RUST_VEC_EXTERNS(RUST_TYPE, CXX_TYPE)                                  \
-  void cxxbridge1$rust_vec$##RUST_TYPE##$new(                                  \
+  CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$new(                                  \
       rust::Vec<CXX_TYPE> *ptr) noexcept;                                      \
-  void cxxbridge1$rust_vec$##RUST_TYPE##$drop(                                 \
+  CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$drop(                                 \
       rust::Vec<CXX_TYPE> *ptr) noexcept;                                      \
-  std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$len(                           \
+  CXX_RS_EXPORT std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$len(                           \
       const rust::Vec<CXX_TYPE> *ptr) noexcept;                                \
-  std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$capacity(                      \
+  CXX_RS_EXPORT std::size_t cxxbridge1$rust_vec$##RUST_TYPE##$capacity(                      \
       const rust::Vec<CXX_TYPE> *ptr) noexcept;                                \
-  const CXX_TYPE *cxxbridge1$rust_vec$##RUST_TYPE##$data(                      \
+  CXX_RS_EXPORT const CXX_TYPE *cxxbridge1$rust_vec$##RUST_TYPE##$data(                      \
       const rust::Vec<CXX_TYPE> *ptr) noexcept;                                \
-  void cxxbridge1$rust_vec$##RUST_TYPE##$reserve_total(                        \
+  CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$reserve_total(                        \
       rust::Vec<CXX_TYPE> *ptr, std::size_t new_cap) noexcept;                 \
-  void cxxbridge1$rust_vec$##RUST_TYPE##$set_len(rust::Vec<CXX_TYPE> *ptr,     \
+  CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$set_len(rust::Vec<CXX_TYPE> *ptr,     \
                                                  std::size_t len) noexcept;    \
-  void cxxbridge1$rust_vec$##RUST_TYPE##$truncate(rust::Vec<CXX_TYPE> *ptr,    \
+  CXX_RS_EXPORT void cxxbridge1$rust_vec$##RUST_TYPE##$truncate(rust::Vec<CXX_TYPE> *ptr,    \
                                                   std::size_t len) noexcept;
 
 #define RUST_VEC_OPS(RUST_TYPE, CXX_TYPE)                                      \
   template <>                                                                  \
   Vec<CXX_TYPE>::Vec() noexcept {                                              \
     cxxbridge1$rust_vec$##RUST_TYPE##$new(this);                               \
   }                                                                            \
   template <>                                                                  \
@@ -702,62 +727,62 @@ static_assert(sizeof(std::string) <= kMaxExpectedWordsInString * sizeof(void *),
   template <>                                                                  \
   void Vec<CXX_TYPE>::truncate(std::size_t len) {                              \
     cxxbridge1$rust_vec$##RUST_TYPE##$truncate(this, len);                     \
   }
 
 #define SHARED_PTR_OPS(RUST_TYPE, CXX_TYPE)                                    \
   static_assert(sizeof(std::shared_ptr<CXX_TYPE>) == 2 * sizeof(void *), "");  \
   static_assert(alignof(std::shared_ptr<CXX_TYPE>) == alignof(void *), "");    \
-  void cxxbridge1$std$shared_ptr$##RUST_TYPE##$null(                           \
+  CXX_RS_EXPORT void cxxbridge1$std$shared_ptr$##RUST_TYPE##$null(             \
       std::shared_ptr<CXX_TYPE> *ptr) noexcept {                               \
     new (ptr) std::shared_ptr<CXX_TYPE>();                                     \
   }                                                                            \
-  CXX_TYPE *cxxbridge1$std$shared_ptr$##RUST_TYPE##$uninit(                    \
+  CXX_RS_EXPORT CXX_TYPE *cxxbridge1$std$shared_ptr$##RUST_TYPE##$uninit(      \
       std::shared_ptr<CXX_TYPE> *ptr) noexcept {                               \
     CXX_TYPE *uninit =                                                         \
         reinterpret_cast<CXX_TYPE *>(new rust::MaybeUninit<CXX_TYPE>);         \
     new (ptr) std::shared_ptr<CXX_TYPE>(uninit);                               \
     return uninit;                                                             \
   }                                                                            \
-  void cxxbridge1$std$shared_ptr$##RUST_TYPE##$clone(                          \
+  CXX_RS_EXPORT void cxxbridge1$std$shared_ptr$##RUST_TYPE##$clone(            \
       const std::shared_ptr<CXX_TYPE> &self,                                   \
       std::shared_ptr<CXX_TYPE> *ptr) noexcept {                               \
     new (ptr) std::shared_ptr<CXX_TYPE>(self);                                 \
   }                                                                            \
-  const CXX_TYPE *cxxbridge1$std$shared_ptr$##RUST_TYPE##$get(                 \
+  CXX_RS_EXPORT const CXX_TYPE *cxxbridge1$std$shared_ptr$##RUST_TYPE##$get(   \
       const std::shared_ptr<CXX_TYPE> &self) noexcept {                        \
     return self.get();                                                         \
   }                                                                            \
-  void cxxbridge1$std$shared_ptr$##RUST_TYPE##$drop(                           \
+  CXX_RS_EXPORT void cxxbridge1$std$shared_ptr$##RUST_TYPE##$drop(             \
       const std::shared_ptr<CXX_TYPE> *self) noexcept {                        \
     self->~shared_ptr();                                                       \
   }                                                                            \
   static_assert(sizeof(std::weak_ptr<CXX_TYPE>) == 2 * sizeof(void *), "");    \
   static_assert(alignof(std::weak_ptr<CXX_TYPE>) == alignof(void *), "");      \
-  void cxxbridge1$std$weak_ptr$##RUST_TYPE##$null(                             \
+  CXX_RS_EXPORT void cxxbridge1$std$weak_ptr$##RUST_TYPE##$null(               \
       std::weak_ptr<CXX_TYPE> *ptr) noexcept {                                 \
     new (ptr) std::weak_ptr<CXX_TYPE>();                                       \
   }                                                                            \
-  void cxxbridge1$std$weak_ptr$##RUST_TYPE##$clone(                            \
+  CXX_RS_EXPORT void cxxbridge1$std$weak_ptr$##RUST_TYPE##$clone(              \
       const std::weak_ptr<CXX_TYPE> &self,                                     \
       std::weak_ptr<CXX_TYPE> *ptr) noexcept {                                 \
     new (ptr) std::weak_ptr<CXX_TYPE>(self);                                   \
   }                                                                            \
-  void cxxbridge1$std$weak_ptr$##RUST_TYPE##$downgrade(                        \
+  CXX_RS_EXPORT void cxxbridge1$std$weak_ptr$##RUST_TYPE##$downgrade(          \
       const std::shared_ptr<CXX_TYPE> &shared,                                 \
       std::weak_ptr<CXX_TYPE> *weak) noexcept {                                \
     new (weak) std::weak_ptr<CXX_TYPE>(shared);                                \
   }                                                                            \
-  void cxxbridge1$std$weak_ptr$##RUST_TYPE##$upgrade(                          \
+  CXX_RS_EXPORT void cxxbridge1$std$weak_ptr$##RUST_TYPE##$upgrade(            \
       const std::weak_ptr<CXX_TYPE> &weak,                                     \
       std::shared_ptr<CXX_TYPE> *shared) noexcept {                            \
     new (shared) std::shared_ptr<CXX_TYPE>(weak.lock());                       \
   }                                                                            \
-  void cxxbridge1$std$weak_ptr$##RUST_TYPE##$drop(                             \
+  CXX_RS_EXPORT void cxxbridge1$std$weak_ptr$##RUST_TYPE##$drop(               \
       const std::weak_ptr<CXX_TYPE> *self) noexcept {                          \
     self->~weak_ptr();                                                         \
   }
 
 // Usize and isize are the same type as one of the below.
 #define FOR_EACH_NUMERIC(MACRO)                                                \
   MACRO(u8, std::uint8_t)                                                      \
   MACRO(u16, std::uint16_t)                                                    \
-- 
2.48.1.502.g6dc24dfdaf-goog