Click here to Skip to main content
15,914,452 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Set CStatic text from a float??? Pin
ldsdbomber13-Feb-06 5:06
ldsdbomber13-Feb-06 5:06 
AnswerRe: Set CStatic text from a float??? Pin
ThatsAlok14-Feb-06 19:54
ThatsAlok14-Feb-06 19:54 
Questionhow to exchange large string between any prog and dll Pin
tbrake13-Feb-06 3:40
tbrake13-Feb-06 3:40 
AnswerRe: how to exchange large string between any prog and dll Pin
Rage13-Feb-06 3:45
professionalRage13-Feb-06 3:45 
AnswerRe: how to exchange large string between any prog and dll Pin
James R. Twine13-Feb-06 4:12
James R. Twine13-Feb-06 4:12 
GeneralRe: how to exchange large string between any prog and dll Pin
BadKarma13-Feb-06 4:57
BadKarma13-Feb-06 4:57 
JokeRe: how to exchange large string between any prog and dll Pin
James R. Twine13-Feb-06 7:31
James R. Twine13-Feb-06 7:31 
GeneralRe: how to exchange large string between any prog and dll Pin
BadKarma13-Feb-06 8:33
BadKarma13-Feb-06 8:33 
James R. Twine wrote:
Besides, I am fairly certain that a DLL loaded into your address space can allocate memory that you can free


It used to be no problem, on OS like Win9x and Win2000. We had writen our own Dll who encrypted some
data returning the BYTE* pointer to the encrypted data which was freed after use in our application. Without any problems what so ever.

We then moved to WinXP and our application crashed on the the delete[] of the memory returning in a access violation.

Found this on the net:
Potential Problems When Crossing DLL Boundaries

It is not possible to allocate memory in a DLL (either explicitly with malloc / new or 
implicitly with aforementioned strdup) and pass the pointer across the DLL boundary into 
the process space to free it, when the DLL and the application are using different copies 
of the CRT (C-RunTime) libraries. This will cause a nasty memory access violation or worse: 
corrupt the heap! When you bump into an assert in the CRT lib when it tries to execute free(),
you will know you have run into this very problem.

Memory is only valid for the copy of the CRT where they were allocated. This means that when
you are using two different CRT libraries (LIBCMT.LIB and MSVCRT.LIB for example) together,
you cannot expect one to correctly free something the other has allocated. Because they most
probably are using different heap managers, the heap runs the risk of becoming corrupted when
you run the application in release mode! Pity the programmer who has to track the bug that 
crashes his application this way.


So its better safe the sorrow.

codito ergo sum
QuestionMulti architecture setup Pin
Allad13-Feb-06 3:30
Allad13-Feb-06 3:30 
QuestionSTL in MFC projects, why??? Pin
Andre xxxxxxx13-Feb-06 2:54
Andre xxxxxxx13-Feb-06 2:54 
AnswerRe: STL in MFC projects, why??? Pin
toxcct13-Feb-06 3:04
toxcct13-Feb-06 3:04 
GeneralRe: STL in MFC projects, why??? Pin
Andre xxxxxxx13-Feb-06 3:40
Andre xxxxxxx13-Feb-06 3:40 
GeneralRe: STL in MFC projects, why??? Pin
toxcct13-Feb-06 3:51
toxcct13-Feb-06 3:51 
GeneralRe: STL in MFC projects, why??? Pin
Andre xxxxxxx13-Feb-06 4:01
Andre xxxxxxx13-Feb-06 4:01 
GeneralRe: STL in MFC projects, why??? Pin
Rob Caldecott13-Feb-06 4:05
Rob Caldecott13-Feb-06 4:05 
GeneralRe: STL in MFC projects, why??? Pin
toxcct13-Feb-06 4:10
toxcct13-Feb-06 4:10 
GeneralRe: STL in MFC projects, why??? Pin
Andre xxxxxxx13-Feb-06 4:22
Andre xxxxxxx13-Feb-06 4:22 
GeneralRe: STL in MFC projects, why??? Pin
Eytukan13-Feb-06 4:58
Eytukan13-Feb-06 4:58 
GeneralRe: STL in MFC projects, why??? Pin
ThatsAlok14-Feb-06 19:56
ThatsAlok14-Feb-06 19:56 
AnswerRe: STL in MFC projects, why??? Pin
David Crow13-Feb-06 3:09
David Crow13-Feb-06 3:09 
GeneralRe: STL in MFC projects, why??? Pin
Andre xxxxxxx13-Feb-06 3:45
Andre xxxxxxx13-Feb-06 3:45 
GeneralRe: STL in MFC projects, why??? Pin
Rage13-Feb-06 3:48
professionalRage13-Feb-06 3:48 
GeneralRe: STL in MFC projects, why??? Pin
Andre xxxxxxx13-Feb-06 4:06
Andre xxxxxxx13-Feb-06 4:06 
GeneralRe: STL in MFC projects, why??? Pin
Rob Caldecott13-Feb-06 4:08
Rob Caldecott13-Feb-06 4:08 
GeneralSTL and CE Pin
Andre xxxxxxx13-Feb-06 4:31
Andre xxxxxxx13-Feb-06 4:31 

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.