PDA

View Full Version : Integrating C with Qt



deepakn
4th December 2007, 06:55
Hello all
I am working on a 'front end' in Qt 4.2.2 for a testing automation program whose backend is done in C.

Could anyone please tell me how I can integrate the C code with Qt?
Specifically, how can i call some functions from the C part in my Qt app?

I tried searching, but its neglecting the term 'C'. Any pointers would be of much help.
Thank you.

ChristianEhrlicher
4th December 2007, 07:45
I don't understand your question - what's the problem simply calling your C-functions?

hb
4th December 2007, 10:12
Could anyone please tell me how I can integrate the C code with Qt?
Specifically, how can i call some functions from the C part in my Qt app?


This is nothing Qt specific. You can just call the functions of your C backend as needed. If your C code is compiled by a C compiler, and not a C++ compiler, you should wrap the function prototypes of the C code in


#ifdef __cplusplus
extern "C" {
#endif

/* ... function prototypes here */

#ifdef __cplusplus
}
#endif


to account for different name mangling of C and C++ compilers.