Use of Non-Unicode DLL in Unicode project
-
Hi, Lets say, I am having Vendor dll and it is non-unicode. I want to use this dll in my Application and it is unicode. DLL is built using SDK functions such way that I cannot make is Unicode, same with Application it cannot build without unicode (frame work dependencies). Both of them are using CString. Is there any way possible by which I can use this dll in my application without changing their nature? Please let me know if further clarification needed. Thanks in advance.
-
Hi, Lets say, I am having Vendor dll and it is non-unicode. I want to use this dll in my Application and it is unicode. DLL is built using SDK functions such way that I cannot make is Unicode, same with Application it cannot build without unicode (frame work dependencies). Both of them are using CString. Is there any way possible by which I can use this dll in my application without changing their nature? Please let me know if further clarification needed. Thanks in advance.
It should be easy enough. Just make sure when calling the vendor supplied DLL to use explicit specialisations of CStringT e.g.
CStringT< char, ChTraitsCRT >
. It might be a good idea to use a typedef for this. Oh, one other thing - make sure that around including the header for the library TCHAR is defined as char and not wchar_t or the functions won't link properly. Cheers, Ash PS: Looks like there are already typedefs in MFC for this sort of thing. Have a look in Alain's answer below for their names!modified on Thursday, October 28, 2010 8:28 AM
-
Hi, Lets say, I am having Vendor dll and it is non-unicode. I want to use this dll in my Application and it is unicode. DLL is built using SDK functions such way that I cannot make is Unicode, same with Application it cannot build without unicode (frame work dependencies). Both of them are using CString. Is there any way possible by which I can use this dll in my application without changing their nature? Please let me know if further clarification needed. Thanks in advance.
Hi, From VS2003 the MFC (or ATL)
CString
classes are specializations ofCStringT
: see http://msdn.microsoft.com/en-us/library/5bzxfsea(VS.71).aspx[^] Explicitly useCStringW
for your framework related code andCStringA
for interaction with your DLL. cheers, ARWhen the wise (person) points at the moon the fool looks at the finger (Chinese proverb)