PDA

View Full Version : How to transcribe types required for a DLL in C types to QT?



josecarlosmissias
10th December 2009, 12:22
Follow the instructions of the development of the library in C attached, please could someone confirm me how to translate the types required in QT types. Eg:

in C:


typedef int (WINAPI *OpenDllECF) (BYTE *Ident, int porta, int veloc, LPSTR String);


I transcribed this for QT


typedef int (*OpenDllPorta)(int porta,int veloc, char *str);


correct?

wysota
10th December 2009, 12:37
What do you mean? You can't change data types just like that...

josecarlosmissias
10th December 2009, 13:20
I want to know how to define a symbol library created in C to be used in an application created in QT.

Sorry I wrote the wrong example, the correct is:



typedef int (WINAPI *OpenDllECF) (BYTE *Ident, int porta, int veloc, LPSTR String);


I transcribed this for QT thus:



typedef int (*OpenDllECF) (int *ident, int porta, int veloc, char *str);


one of my questions is:

Should I include "# include <windows.h>", and...



typedef int (WINAPI *OpenDllECF) (int *ident, int porta, int veloc, char *str);


this is correct?

wysota
10th December 2009, 13:41
The function has its types determined. You can't change them regardless of the environment you are using that function in - you have to use the same data types, so in your case BYTE*, int, int, LPSTR. BYTE* is probably a typedef to uchar* or short* and LPSTR is probably a typedef to const char* but it might depends on the architecture so I'd stick with BYTE and LPSTR.

And please don't start multiple threads on the same subject.

http://www.qtcentre.org/forum/f-newbie-4/t-error-message-the-application-crashed-26285.html

josecarlosmissias
10th December 2009, 16:37
Ok, solved.