Click here to Skip to main content
15,919,749 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Find control on dialog Pin
Force Code21-May-08 11:37
Force Code21-May-08 11:37 
GeneralRe: Find control on dialog Pin
Giorgi Dalakishvili21-May-08 11:50
mentorGiorgi Dalakishvili21-May-08 11:50 
GeneralRe: Find control on dialog Pin
Force Code21-May-08 12:14
Force Code21-May-08 12:14 
GeneralRe: Find control on dialog Pin
Rajesh R Subramanian21-May-08 20:21
professionalRajesh R Subramanian21-May-08 20:21 
AnswerRe: Find control on dialog Pin
Rajesh R Subramanian21-May-08 19:51
professionalRajesh R Subramanian21-May-08 19:51 
GeneralRe: Find control on dialog Pin
Giorgi Dalakishvili21-May-08 19:58
mentorGiorgi Dalakishvili21-May-08 19:58 
Questionmodifying an REOBJECT Pin
Force Code21-May-08 10:00
Force Code21-May-08 10:00 
QuestionINCONSISTENCY IN VC++ Pin
edu.net21-May-08 9:35
edu.net21-May-08 9:35 
This is more of an observation than a question.

I have a dll and an exe that uses the dll exports. I export classes from the dll using __declspec(dllexport) (the usual #define SOMENAME that takes care of __declspec(dllexport) and __declspec(dllimport)). I have a template class in the dll. When the class has the __declspec(dllexport)/__declspec(dllimport) attribute, I get a LNK2019 error when i build the exe with all the linker switches appropriately set. I make the class methods inline by implementing them in the header file, still LNK2019. I leave the methods inline and remove the __declspec(dllexport)/__declspec(dllimport) attribute and voila, LNK2019 gone and I can use the class in the exe. I should not be able to use the class in the exe, unless I use one of the export methods, BUT IT WORKS.

I actually reproduced this behaviour and still can't find the docs that say 'DO NOT DECORATE TEMPLATE CLASSES WITH __declspec(dllexport)/__declspec(dllimport) ATTRIBUTE'.

Here's an example:

mydll.h
#ifdef MY_DLL_NAME
  #define DLL_EXPORTS __declspec(dllexport)
#else
  #define DLL_EXPORTS __declspec(dllimport)
#endif

template<typename T>
class DLL_EXPORTS MyDllClass
{
 public:
  MyDllClass(){}
 public:
  ~MyDllClass(){}
};

myexe.h

#include "mydll.h" // Ensure linker can access mydll.lib and mydll.h

class MyExeClass
{
 public:
  MyExeClass(){}

 public:
  ~MyExeClass(){}

 public:
  VOID MyExeFunc()
  {
    MyDllClass<Someclass> var;  //  Remove DLL_EXPORTS to resolve LNK2019. 
  }
};

Is this behaviour expected? Is it documented?



Love is the illusion that one kiss is different from another. - e.m

GeneralRe: INCONSISTENCY IN VC++ Pin
JudyL_MD21-May-08 10:02
JudyL_MD21-May-08 10:02 
GeneralRe: INCONSISTENCY IN VC++ Pin
edu.net21-May-08 10:40
edu.net21-May-08 10:40 
QuestionRe: INCONSISTENCY IN VC++ Pin
CPallini21-May-08 10:48
mveCPallini21-May-08 10:48 
QuestionHow to view .lib contents Pin
Jesse Evans21-May-08 7:57
Jesse Evans21-May-08 7:57 
AnswerRe: How to view .lib contents Pin
CPallini21-May-08 8:13
mveCPallini21-May-08 8:13 
GeneralRe: How to view .lib contents Pin
Jesse Evans21-May-08 8:23
Jesse Evans21-May-08 8:23 
GeneralYou're welcome. Pin
CPallini21-May-08 9:39
mveCPallini21-May-08 9:39 
GeneralRe: You're welcome. Pin
Hamid_RT21-May-08 17:56
Hamid_RT21-May-08 17:56 
GeneralRe: You're welcome. Pin
CPallini21-May-08 21:41
mveCPallini21-May-08 21:41 
GeneralRe: You're welcome. Pin
Hamid_RT21-May-08 23:27
Hamid_RT21-May-08 23:27 
GeneralRe: You're welcome. Pin
ThatsAlok16-Jul-09 20:37
ThatsAlok16-Jul-09 20:37 
JokeRe: You're welcome. Pin
Rajesh R Subramanian21-May-08 20:18
professionalRajesh R Subramanian21-May-08 20:18 
GeneralRe: You're welcome. Pin
CPallini21-May-08 21:41
mveCPallini21-May-08 21:41 
JokeRe: You're welcome. Pin
Cedric Moonen21-May-08 20:32
Cedric Moonen21-May-08 20:32 
GeneralRe: You're welcome. Pin
CPallini21-May-08 21:39
mveCPallini21-May-08 21:39 
GeneralRe: You're welcome. Pin
Rajkumar R22-May-08 1:05
Rajkumar R22-May-08 1:05 
GeneralRe: You're welcome. Pin
CPallini22-May-08 1:54
mveCPallini22-May-08 1:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.