c++ - Handling TCHARs in header files for libraries with different character sets -
I have a project that uses two-thirds of party libraries, both of which have TCHAR's Use. Unfortunately, a library is compiled as multi-byte (it is library A), and the second is compiled as Unicode (call it Library B).
The way I think now is that TCHH is either based on the build options of wchar or char with the precompiler. So when the library was compiled of any kind, then the TCHAR parameter of that type was set to expect the parameters of type four, and in Library B to find the parameters of a type of warterm parameter Has been set up for.
Unfortunately, my consumption application is also to get a character set. If I take the Unicode then the header file that I've included for the library tells me that the method wants a warning, Because when I compile TCHAR in the title, they are interpreted as the walkers in. TCHARS is defined within the structures. I have confirmed this behavior in practice, when I Allocated and pass a TCHAR buffer, I get the garbage back because it fills my watch buffer with multi-byte data.
My question is: is there a clear way to consume these two libraries in the same application? Am I using these libraries, am I doing something wrong?
Assume that you are not using any of these libraries / functions, I I will wrap the library completely. Let's say if you have decided to use the MBC in your app and have wrapped Library B (Unicode), then your wrapper header file wchar_t instead of TCHAR , So the #define interface will not affect you. Inside the capp file of your cover where you include headers of #Builder B, you match the #defined TCHAR library. No code should be allowed to view any code other than your cover. B.
If you are using more than some class / function in these two libraries, keeping the rapper code will solve its problem soon.
Comments
Post a Comment