PDA

View Full Version : Why does Qt not work with dll compiled with multi-bytes?



drunknight
19th July 2014, 18:08
I am currently working on a program that using dll produced by multi-bytes.

I designed a GUI and have put my dll into the GUI.

After I have done this, I tried out my program, The dll and the GUI code can work perfectly well seperately, but when they combined the program does not work .

I have done a test, and figured out that it was the unicode/multibyte problem.

I am kinda stuck at this problem for hours now... hope you guys can help me!

ChrisW67
19th July 2014, 22:03
What exactly do you mean by "multi-byte"?
What exactly does, "does not work" mean? Does not compile, does not run at all, or does odd things?
Can you post the compilation errors? Can you post a short example code that demonstrates the problem?

drunknight
20th July 2014, 04:28
Ok, let me show you what happened. I'll demonstrate in two parts.
First part: I have created two projects in VS2010. The first one is for test. The other one is for GUI.The test is a simple console program. When i set (Property->Configuration Properties->General->project Defaults->character set) to (use multi-byte character set), it works well. But when i change it to (use unicode character set), compiler said "error LNK2019: unresolved external symbol".So i think it must be about the character set. So i came to the GUI. I changed the character set just as i did in the test program. But it turned out that it did't work out with GUI program. So i am confused.

Second part: I will give you some code pieces in my project.
test program:


#include "stdafx.h"
#include "head.h"


#pragma comment(lib,"test.lib")
BOOL __declspec(dllimport) TEST(LPCTSTR in_filename,LPCTSTR in_file_name2,LPCTSTR out_file_name,LPCTSTR out_file_name2);


int _tmain(int argc, _TCHAR* argv[])
{
LPCTSTR a = LPCTSTR("in.dat");
LPCTSTR b = LPCTSTR("in2.dat");
LPCTSTR c = LPCTSTR("out.dat");
LPCTSTR d = LPCTSTR("out2.dat");

BOOL bSuccess =TEST(a,b,c,d);
return 0;
}

GUI program:
I use the same method as in the console one, while the character set change doesn't matter.