Click here to Skip to main content
15,888,097 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: what is different between hIconSm and hIcon? Pin
Hamid_RT12-Sep-06 8:34
Hamid_RT12-Sep-06 8:34 
Questionreading text file with some binary data using CStdioFile Pin
Tanzim Husain11-Sep-06 10:35
Tanzim Husain11-Sep-06 10:35 
AnswerRe: reading text file with some binary data using CStdioFile Pin
led mike11-Sep-06 10:44
led mike11-Sep-06 10:44 
QuestionTemplates and dynamic libraries Pin
Federico Milano11-Sep-06 9:52
Federico Milano11-Sep-06 9:52 
AnswerRe: Templates and dynamic libraries Pin
Zac Howland11-Sep-06 10:22
Zac Howland11-Sep-06 10:22 
GeneralRe: Templates and dynamic libraries Pin
Federico Milano11-Sep-06 10:27
Federico Milano11-Sep-06 10:27 
GeneralRe: Templates and dynamic libraries Pin
Zac Howland11-Sep-06 10:33
Zac Howland11-Sep-06 10:33 
GeneralRe: Templates and dynamic libraries Pin
Jörgen Sigvardsson11-Sep-06 11:55
Jörgen Sigvardsson11-Sep-06 11:55 
You have two solutions:
1) Use the pimpl idiom
2) Use the Microsoft export "hack"

1) By pimpl idiom I mean:
// Header
class Class {
   struct Pimpl;
   Pimpl* m_pimpl;
public:
   Class();
   ~Class();
   void SetX(int x);
};
  
// Source file
struct Class::Pimpl { int x; }
 
Class::Class() : m_pimpl(new Pimpl)
{
}
 
Class::~Class() { delete m_pimpl; }
  
void Class::SetX(int x) { m_pimpl->x = x; }

That also has the benefit to minimize dependencies between sourcefiles. If you change a data member, only the .cpp containing the Pimpl struct will be recompiled - not all other files which include the header file. More on this idiom can be read here: http://www.gotw.ca/gotw/028.htm[^]

2) This hack is non portable AFAIK. On the other hand, exporting C++ classes is non portable as well, so I guess it's not a problem for you. You can read more about it here: http://support.microsoft.com/kb/q168958/[^]


--
Torn from tomorrow's headlines

AnswerRe: Templates and dynamic libraries Pin
cmk11-Sep-06 17:43
cmk11-Sep-06 17:43 
Questionhow to save a bitmap to gif file with transparent backgraound? Pin
includeh1011-Sep-06 9:03
includeh1011-Sep-06 9:03 
AnswerRe: how to save a bitmap to gif file with transparent backgraound? Pin
mostafa_pasha11-Sep-06 9:31
mostafa_pasha11-Sep-06 9:31 
GeneralRe: how to save a bitmap to gif file with transparent backgraound? Pin
mostafa_pasha11-Sep-06 9:36
mostafa_pasha11-Sep-06 9:36 
AnswerRe: how to save a bitmap to gif file with transparent backgraound? Pin
Waldermort11-Sep-06 9:33
Waldermort11-Sep-06 9:33 
GeneralRe: how to save a bitmap to gif file with transparent backgraound? Pin
Chris Losinger11-Sep-06 9:57
professionalChris Losinger11-Sep-06 9:57 
GeneralRe: how to save a bitmap to gif file with transparent backgraound? Pin
Waldermort11-Sep-06 19:23
Waldermort11-Sep-06 19:23 
GeneralRe: how to save a bitmap to gif file with transparent backgraound? Pin
Chris Losinger12-Sep-06 1:00
professionalChris Losinger12-Sep-06 1:00 
QuestionCustom Wizard issues Pin
the_jebus11-Sep-06 8:47
the_jebus11-Sep-06 8:47 
AnswerRe: Custom Wizard issues Pin
the_jebus11-Sep-06 8:49
the_jebus11-Sep-06 8:49 
Questionmemory allocation question Pin
KellyR11-Sep-06 8:36
KellyR11-Sep-06 8:36 
AnswerRe: memory allocation question Pin
Zac Howland11-Sep-06 8:40
Zac Howland11-Sep-06 8:40 
QuestionPositioning in file Pin
Monin D.11-Sep-06 8:28
Monin D.11-Sep-06 8:28 
AnswerRe: Positioning in file Pin
Zac Howland11-Sep-06 8:39
Zac Howland11-Sep-06 8:39 
AnswerRe: Positioning in file Pin
Michael Dunn11-Sep-06 8:42
sitebuilderMichael Dunn11-Sep-06 8:42 
GeneralRe: Positioning in file Pin
Monin D.11-Sep-06 9:24
Monin D.11-Sep-06 9:24 
AnswerRe: Positioning in file Pin
mostafa_pasha11-Sep-06 9:41
mostafa_pasha11-Sep-06 9:41 

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.