How to deal with a third party DLL exporting STL symbols?

I am working on a project that is dependent on a third-party DLL. For reasons unknown, this DLL exports (most but not all) of the symbols for std::vector<unsigned char>.

$ dumpbin.exe -exports Problem.lib | grep 'std::vector'
                  ??0?$vector@EV?$allocator@E@std@@@std@@QEAA@$$QEAV01@@Z (public: __cdecl std::vector<unsigned char,class std::allocator<unsigned char> >::vector<unsigned char,class std::allocator<unsigned char> >(class std::vector<unsigned char,class std::allocator<unsigned char> > &&))
                  ??0?$vector@EV?$allocator@E@std@@@std@@QEAA@$$QEAV01@AEBV?$allocator@E@1@@Z (public: __cdecl std::vector<unsigned char,class std::allocator<unsigned char> >::vector<unsigned char,class std::allocator<unsigned char> >(class std::vector<unsigned char,class std::allocator<unsigned char> > &&,class std::allocator<unsigned char> const &))
                  ??0?$vector@EV?$allocator@E@std@@@std@@QEAA@AEBV01@@Z (public: __cdecl std::vector<unsigned char,class std::allocator<unsigned char> >::vector<unsigned char,class std::allocator<unsigned char> >(class std::vector<unsigned char,class std::allocator<unsigned char> > const &))
                  ??0?$vector@EV?$allocator@E@std@@@std@@QEAA@AEBV01@AEBV?$allocator@E@1@@Z (public: __cdecl std::vector<unsigned char,class std::allocator<unsigned char> >::vector<unsigned char,class std::allocator<unsigned char> >(class std::vector<unsigned char,class std::allocator<unsigned char> > const &,class std::allocator<unsigned char> const &))
                  ??0?$vector@EV?$allocator@E@std@@@std@@QEAA@AEBV?$allocator@E@1@@Z (public: __cdecl std::vector<unsigned char,class std::allocator<unsigned char> >::vector<unsigned char,class std::allocator<unsigned char> >(class std::allocator<unsigned char> const &))
                  ??0?$vector@EV?$allocator@E@std@@@std@@QEAA@V?$initializer_list@E@1@AEBV?$allocator@E@1@@Z (public: __cdecl std::vector<unsigned char,class std::allocator<unsigned char> >::vector<unsigned char,class std::allocator<unsigned char> >(class std::initializer_list<unsigned char>,class std::allocator<unsigned char> const &))
                  ??0?$vector@EV?$allocator@E@std@@@std@@QEAA@XZ (public: __cdecl std::vector<unsigned char,class std::allocator<unsigned char> >::vector<unsigned char,class std::allocator<unsigned char> >(void))
                  ??0?$vector@EV?$allocator@E@std@@@std@@QEAA@_KAEBEAEBV?$allocator@E@1@@Z (public: __cdecl std::vector<unsigned char,class std::allocator<unsigned char> >::vector<unsigned char,class std::allocator<unsigned char> >(unsigned __int64,unsigned char const &,class std::allocator<unsigned char> const &))
                  ??0?$vector@EV?$allocator@E@std@@@std@@QEAA@_KAEBV?$allocator@E@1@@Z (public: __cdecl std::vector<unsigned char,class std::allocator<unsigned char> >::vector<unsigned char,class std::allocator<unsigned char> >(unsigned __int64,class std::allocator<unsigned char> const &))
                  ??1?$vector@EV?$allocator@E@std@@@std@@QEAA@XZ (public: __cdecl std::vector<unsigned char,class std::allocator<unsigned char> >::~vector<unsigned char,class std::allocator<unsigned char> >(void))
                  ...

This means that if we attempt to use std::vector<unsigned char> anywhere else in the codebase, the application will fail to link due to duplicate symbols:

Problem.lib(Problem.dll) : error LNK2005: "public: __cdecl std::vector<unsigned char,class std::allocator<unsigned char> >::~vector<unsigned char,class std::allocator<unsigned char> >(void)" (??1?$vector@EV?$allocator@E@std@@@std@@QEAA@XZ) already defined in Application.obj
   Creating library C:UsersParkerprojectApplication.lib and object C:UsersParkerProjectApplication.exp
C:UsersParkerprojectApplication.exe : fatal error LNK1169: one or more multiply defined symbols found

I do not have the source code for this DLL and am unable to obtain a new version of it from the vendor. I have no reason to believe that these symbols were exported intentionally, but there is no chance of seeing this mistake fixed on the vendor’s end.

I have thought of a few potential workarounds for this issue:

  • Modify the stub .lib to remove these symbols from the list of exported symbol. I have no idea if this can be done and have been unable to find the right search terms to figure that out.
  • Use C++11’s extern template feature to try to just use the implementations in the DLL. This feels weird, as I’ve never seen extern template used across a DLL boundary, and I don’t know if it is even supposed to work. My experiments thus far have been unsuccessful.
  • Just avoid using std::vector<unsigned char> entirely in application code. This feels extreme, but may actually require the least effort in the short term.

I realize this is an incredibly niche and stupid situation, but any guidance on potential workarounds would very much be appreciated.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật