Re: Visual C++ 6.0 DLL question
From: Blake (Blake_at_discussions.microsoft.com)
Date: 10/18/04
- Next message: Ravi Ambros Wallau: "Re: very urgent: Problem converting version 6.0 project to version 7.0"
- Previous message: Ravi Ambros Wallau: "Re: saving input to files"
- In reply to: Tim Robinson: "Re: Visual C++ 6.0 DLL question"
- Next in thread: Tim Robinson: "Re: Visual C++ 6.0 DLL question"
- Reply: Tim Robinson: "Re: Visual C++ 6.0 DLL question"
- Reply: Arnaud Debaene: "Re: Visual C++ 6.0 DLL question"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 18 Oct 2004 08:15:02 -0700
This method works fine and dandy for regular classes, but what about template
classes? In VC++ 6.0, I found a template class has to be all in the header
file in order to compile, so I have my header file for the class and at the
end of the file I include the source file.
Now I want to include a few template classes in my DLL. I try doing the
method below but a get dozens of errors when compiling. I would like these
template classes to be in my DLL because I have other classes in the same DLL
that use these template classes. Is there any way to do this?
Thanks!
Blake
"Tim Robinson" wrote:
> Blake wrote:
> > Hi. I am trying to create a DLL that contains a bunch of classes and only
> > classes (basically no regular functions). I create a Win32 DLL empty project.
> > I then create a source file with the DLLEntry() function (code copied
> > directly from the documentation) and throw in my class header and source
> > files. I go to compile it and the DLL is generated but not LIB or EXP files
> > are created, which I need if I want to use my DLL in other projects.
> >
> > What do I need to add/change in my project to generate these LIB and EXP
> > files?
>
> You need to export something. If you're exporting classes, use the
> __declspec keyword as follows:
>
> class __declspec(dllexport) ExportedClass
> {
> // ...
> };
>
> This will cause all of the class's member functions and static members
> to be exported from the DLL. This will cause the linker to emit a .LIB
> file, which client applications can link to.
>
> --
> Tim Robinson (MVP, Windows SDK)
> http://mobius.sourceforge.net/
>
- Next message: Ravi Ambros Wallau: "Re: very urgent: Problem converting version 6.0 project to version 7.0"
- Previous message: Ravi Ambros Wallau: "Re: saving input to files"
- In reply to: Tim Robinson: "Re: Visual C++ 6.0 DLL question"
- Next in thread: Tim Robinson: "Re: Visual C++ 6.0 DLL question"
- Reply: Tim Robinson: "Re: Visual C++ 6.0 DLL question"
- Reply: Arnaud Debaene: "Re: Visual C++ 6.0 DLL question"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|