PDA

View Full Version : crossplatform library Qt macros



tuli
12th August 2013, 07:01
I have an existing library for VS on windows, which i want to turn into a compiler and OS agnostic one.

Basically, the code looks like this:


#define D_CDECL __cdecl
#define D_EXPORT __declspec(dllexport)
#define D_EXTERN extern "C"

//...

D_EXTERN int D_EXPORT D_CDECL Test( int tst )


The documentation of similar Qt macros is very scarce to non-existant, but i found these of interests:


D_EXTERN - Q_EXTERN_C
D_EXPORT - Q_DECL_EXPORT
D_CDECL - ???


So far, so good. (extern_c is a language feature anyways and Q_EXPORT seems to be deprecated in Qt 484 for Q_DECL_EXPORT.)
But what about the cdecl calling convention? How can i get that compiler-generic?

c naming via extern_c doesnt imply the c calling convention via __cdecl in VS, so i have to specify it somehow.

But how?




Furthermore, these may be of interest...but no documentation seems to be available.

Q_EXPORT_PLUGIN

Q_DECL_ALIGN

Q_STANDARD_CALL