Click here to Skip to main content
15,900,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Pointer Casting warning Pin
tushar_patil20-Sep-11 20:57
tushar_patil20-Sep-11 20:57 
QuestionCTreeView classname Pin
_Flaviu15-Sep-11 8:21
_Flaviu15-Sep-11 8:21 
AnswerRe: CTreeView classname Pin
_Flaviu15-Sep-11 9:00
_Flaviu15-Sep-11 9:00 
AnswerRe: CTreeView classname Pin
etherCao17-Sep-11 12:44
etherCao17-Sep-11 12:44 
QuestionDLL native win32 variables lifetime? Pin
skaboFer15-Sep-11 3:28
skaboFer15-Sep-11 3:28 
AnswerRe: DLL native win32 variables lifetime? Pin
MicroVirus15-Sep-11 3:57
MicroVirus15-Sep-11 3:57 
AnswerRe: DLL native win32 variables lifetime? Pin
Erudite_Eric15-Sep-11 4:08
Erudite_Eric15-Sep-11 4:08 
AnswerRe: DLL native win32 variables lifetime? Pin
Richard MacCutchan15-Sep-11 4:17
mveRichard MacCutchan15-Sep-11 4:17 
skaboFer wrote:
I mean, my doubt is what is the lifetime of the variables in a dynamic win32 dll.

In general the only variables you shaould keep in your DLL are const values that will never change. All non-const variables should belong in your main program and be passed to the DLL routine as required, in the same way as in C#. In your sample function above you define a library function (in the DLL) with the signature
C++
WriteCommMsg(MsgStr * msg)

Here msg is a pointer (reference in C#) to a variable of type MsgStr, but the actual data that msg refers to is stored within the application not the DLL, something like:
C++
MsgStr myMsgString = "message to write"; // setup the message string
WriteCommMsg(&myMsgString);              // send it to the library function


If you wish to keep variable data within your library routines during the lifetime of your application then you should use a static library rather than a DLL.
Unrequited desire is character building. OriginalGriff


GeneralRe: DLL native win32 variables lifetime? Pin
skaboFer15-Sep-11 4:35
skaboFer15-Sep-11 4:35 
GeneralRe: DLL native win32 variables lifetime? Pin
Richard MacCutchan15-Sep-11 5:42
mveRichard MacCutchan15-Sep-11 5:42 
GeneralRe: DLL native win32 variables lifetime? Pin
skaboFer15-Sep-11 5:53
skaboFer15-Sep-11 5:53 
QuestionLibrary Usage Problem Pin
AmbiguousName14-Sep-11 23:06
AmbiguousName14-Sep-11 23:06 
AnswerRe: Library Usage Problem Pin
Erudite_Eric14-Sep-11 23:19
Erudite_Eric14-Sep-11 23:19 
AnswerRe: Library Usage Problem Pin
MicroVirus15-Sep-11 3:47
MicroVirus15-Sep-11 3:47 
GeneralRe: Library Usage Problem Pin
Erudite_Eric15-Sep-11 22:13
Erudite_Eric15-Sep-11 22:13 
GeneralRe: Library Usage Problem Pin
Albert Holguin16-Sep-11 3:59
professionalAlbert Holguin16-Sep-11 3:59 
GeneralRe: Library Usage Problem Pin
MicroVirus16-Sep-11 4:40
MicroVirus16-Sep-11 4:40 
GeneralRe: Library Usage Problem Pin
Erudite_Eric16-Sep-11 4:49
Erudite_Eric16-Sep-11 4:49 
GeneralRe: Library Usage Problem Pin
MicroVirus16-Sep-11 12:16
MicroVirus16-Sep-11 12:16 
AnswerRe: Library Usage Problem Pin
Richard MacCutchan14-Sep-11 23:36
mveRichard MacCutchan14-Sep-11 23:36 
GeneralRe: Library Usage Problem Pin
Albert Holguin16-Sep-11 4:03
professionalAlbert Holguin16-Sep-11 4:03 
GeneralRe: Library Usage Problem Pin
Richard MacCutchan16-Sep-11 5:24
mveRichard MacCutchan16-Sep-11 5:24 
GeneralRe: Library Usage Problem Pin
Albert Holguin16-Sep-11 5:58
professionalAlbert Holguin16-Sep-11 5:58 
AnswerRe: Library Usage Problem Pin
Chris Meech15-Sep-11 8:18
Chris Meech15-Sep-11 8:18 
QuestionDesign of Application Pin
002comp14-Sep-11 23:04
002comp14-Sep-11 23:04 

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.