Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, April 2007
DLL exporting functions, variables, class


Message 1 in thread

Hi all,

Can anyone help me with a small sample code tht how can I export a class
fm a dll in Qt.

I want to make a class in a dll n want to inherit fm this class in my
application.

How this is done in Qt.

Thanks

Shuchi


Message 2 in thread

There is nothing Qt specific to this - it's all Windows specific.

#define a macro that expands to __declspec(dllexport) when you build your 
DLL, and to __declspec(dllimport) when you use your DLL (and to nothing if 
you are not on Windows).

Set a define in your DLL project that you can test using the DEFINES 
variable in your .pro file.


#if defined(Q_WS_WIN)
# if defined(BUILD_MYDLL)
#   define MYDLL_EXPORT __declspec(dllexport)
# else
#   define MYDLL_EXPORT __declspec(dllimport)
# endif
#else
# define MYDLL_EXPORT
#endif

Then use the macro in your class declaration.

See MSDN for details.

Volker


"shuchi, Agrawal (IE10)" <shuchi.agrawal@xxxxxxxxxxxxx> wrote in message 
news:EB493C98A0338748AA3D997E071B05741740A5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all,

Can anyone help me with a small sample code tht how can I export a class
fm a dll in Qt.

I want to make a class in a dll n want to inherit fm this class in my
application.

How this is done in Qt.

Thanks

Shuchi



--
 [ signature omitted ] 

Message 3 in thread

On 2007-04-24 08:44:08 -0400, "shuchi, Agrawal (IE10)" 
<shuchi.agrawal@xxxxxxxxxxxxx> said:

> 
> 
> Hi all,
> 
> Can anyone help me with a small sample code tht how can I export a class
> fm a dll in Qt.
> 
> I want to make a class in a dll n want to inherit fm this class in my
> application.
> 
> How this is done in Qt.
> 
> Thanks
> 
> Shuchi
> 
> 
> 


This link helped immensely when I ported my c++ code to windows from unix:

http://msdn2.microsoft.com/en-us/library/ms235636(VS.80).aspx

Mike 

--
 [ signature omitted ]