Re: exporting classes in a DLL
- From: "Nishant Sivakumar" <nish@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 19 Jul 2005 16:17:59 +0530
The class declaration header file should look something like this :-
#ifdef EXPORTSCLASS
#define EXPORTCLASS_API __declspec(dllexport)
#else
#define EXPORTCLASS_API __declspec(dllimport)
#endif
class EXPORTCLASS_API CMyClass
{
public:
//...
};
When you use this in the DLL project, define EXPORTSCLASS, but refrain from
doing so in the EXE project where you call this dll.
--
Regards,
Nish [VC++ MVP]
http://www.voidnish.com
http://blog.voidnish.com
"Alfonso Morra" <sweet-science@xxxxxxxxxxxx> wrote in message
news:dbij8j$km8$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
>
> Rodrigo Corral [MVP] wrote:
>
>> // in your header...
>>
>> class __declspec(dllexport) CDllTest
>> {
>> public:
>> CDllTest(){}
>> ~CDllTest(){}
>>
>> public:
>> void SayHello();
>> };
>>
>> // in your cpp...
>>
>> void CDllTest::SayHello()
>> {
>> printf(_T("Hello World!!"));
>> }
>>
>> Another option: if you create a new dll project using VS it will create
>> an example dummy exported class.
>>
>>
>
> Thanks - but that's on the exporting side of things. I wanted to know how
> to use the exported classes in a seperate project that imports the classes
> and uses them. The code you gave above, only shows how to export the
> classes (which I already know how to do).
>
> mtia
>
.
- Follow-Ups:
- Re: exporting classes in a DLL
- From: Alfonso Morra
- Re: exporting classes in a DLL
- From: Alfonso Morra
- Re: exporting classes in a DLL
- References:
- exporting classes in a DLL
- From: Alfonso Morra
- Re: exporting classes in a DLL
- From: Rodrigo Corral [MVP]
- Re: exporting classes in a DLL
- From: Alfonso Morra
- exporting classes in a DLL
- Prev by Date: Re: C++/CLI and fixed size buffers
- Next by Date: Re: How does STL map deal with scoping and memory persistance
- Previous by thread: Re: exporting classes in a DLL
- Next by thread: Re: exporting classes in a DLL
- Index(es):