Click here to Skip to main content
15,905,427 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Error regarding .sbr file in VC++ 2005 Pin
yudhisthira5-Aug-07 19:56
yudhisthira5-Aug-07 19:56 
GeneralRe: Error regarding .sbr file in VC++ 2005 Pin
ThatsAlok5-Aug-07 20:20
ThatsAlok5-Aug-07 20:20 
Questionstatic member variable, dll export and multiple translation units Pin
devvvy5-Aug-07 15:43
devvvy5-Aug-07 15:43 
AnswerRe: static member variable, dll export and multiple translation units [modified*2] Pin
Mark Salsbery5-Aug-07 16:41
Mark Salsbery5-Aug-07 16:41 
GeneralRe: static member variable, dll export and multiple translation units Pin
devvvy5-Aug-07 18:42
devvvy5-Aug-07 18:42 
GeneralRe: static member variable, dll export and multiple translation units Pin
Mark Salsbery5-Aug-07 19:23
Mark Salsbery5-Aug-07 19:23 
GeneralRe: static member variable, dll export and multiple translation units [modified*2] Pin
devvvy5-Aug-07 22:17
devvvy5-Aug-07 22:17 
GeneralRe: static member variable, dll export and multiple translation units Pin
Mark Salsbery6-Aug-07 4:59
Mark Salsbery6-Aug-07 4:59 
For a true global variable/function you need ONE instance of it. 

In your case it was in DLL A. 

For other modules to be able to use the globals, you need to export it from
the DLL it exists in and import it in any module that uses it.

By using the preprocessor directives, you can keep the declaration in one header file
instead of two (one for export, one for import).  Any changes to the class only have to
be made in one place.

This is how MFC is built, except there's a 3rd option, since MFC can also be built into a
static library.

By the way, you can also import/export individual static members of a class instead of
importing/exporting the entire class.  Same method except you put the __declspec()
on the variable declaration instead of the class declaration.

Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: static member variable, dll export and multiple translation units [modified*2] Pin
devvvy5-Aug-07 22:24
devvvy5-Aug-07 22:24 
GeneralRe: static member variable, dll export and multiple translation units Pin
Mark Salsbery6-Aug-07 5:01
Mark Salsbery6-Aug-07 5:01 
GeneralRe: static member variable, dll export and multiple translation units Pin
devvvy6-Aug-07 13:57
devvvy6-Aug-07 13:57 
GeneralRe: static member variable, dll export and multiple translation units Pin
Mark Salsbery6-Aug-07 14:22
Mark Salsbery6-Aug-07 14:22 
Question2 dim numbers.. Pin
_80865-Aug-07 7:54
_80865-Aug-07 7:54 
AnswerRe: 2 dim numbers.. Pin
Maxwell Chen13-Aug-07 0:56
Maxwell Chen13-Aug-07 0:56 
Questionabout static libraries Pin
mt_samiei5-Aug-07 4:01
mt_samiei5-Aug-07 4:01 
QuestionRe: about static libraries Pin
Mark Salsbery5-Aug-07 7:40
Mark Salsbery5-Aug-07 7:40 
QuestionHighlight text in static control Pin
Legolas655-Aug-07 1:55
Legolas655-Aug-07 1:55 
AnswerRe: Highlight text in static control Pin
Hamid_RT5-Aug-07 3:49
Hamid_RT5-Aug-07 3:49 
GeneralRe: Highlight text in static control Pin
Legolas655-Aug-07 6:31
Legolas655-Aug-07 6:31 
GeneralRe: Highlight text in static control Pin
Hamid_RT5-Aug-07 19:02
Hamid_RT5-Aug-07 19:02 
AnswerRe: Highlight text in static control Pin
henky@online-resource.org5-Aug-07 23:10
henky@online-resource.org5-Aug-07 23:10 
QuestionSplitter in MDI Frame Pin
sawerr5-Aug-07 1:10
sawerr5-Aug-07 1:10 
AnswerRe: Splitter in MDI Frame Pin
sawerr5-Aug-07 6:43
sawerr5-Aug-07 6:43 
AnswerRe: Splitter in MDI Frame Pin
Mark Salsbery5-Aug-07 12:47
Mark Salsbery5-Aug-07 12:47 
GeneralRe: Splitter in MDI Frame [modified] Pin
sawerr5-Aug-07 19:08
sawerr5-Aug-07 19:08 

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.