Invalid Address specified to RtlFreeHeap
-
I get this error message when I call a function in a MFC-Extension Dll (in Release-Mode) while debugging my MFC-Application. If both (App and Dll) are in the same state (debug or release) everything is fine. I was able to reduce the problem to only a few lines of code. However I can not see what should be wrong in my program. To reproduce this problem create an extension Dll and add the two files foo.h and foo.cpp ----- foo.h IMP_EXP void Foo(CString& sVal); ----- foo.cpp #include "stdafx.h" #define IMP_EXP __declspec(dllexport) #include "foo.h" void Foo(CString& sVal) { sVal = "12345"; } ----- end of foo.cpp Then create a MFC-App and include the following lines ----- any cpp-file of your app #define IMP_EXP __declspec(dllimport) #include "[Your Path]\Foo.h" #pragma comment(lib, "[Your Dll-Name]") void MyFunc() { CString str; str.Empty(); Foo(str); } Thanks for your help :confused: Rainer
-
I get this error message when I call a function in a MFC-Extension Dll (in Release-Mode) while debugging my MFC-Application. If both (App and Dll) are in the same state (debug or release) everything is fine. I was able to reduce the problem to only a few lines of code. However I can not see what should be wrong in my program. To reproduce this problem create an extension Dll and add the two files foo.h and foo.cpp ----- foo.h IMP_EXP void Foo(CString& sVal); ----- foo.cpp #include "stdafx.h" #define IMP_EXP __declspec(dllexport) #include "foo.h" void Foo(CString& sVal) { sVal = "12345"; } ----- end of foo.cpp Then create a MFC-App and include the following lines ----- any cpp-file of your app #define IMP_EXP __declspec(dllimport) #include "[Your Path]\Foo.h" #pragma comment(lib, "[Your Dll-Name]") void MyFunc() { CString str; str.Empty(); Foo(str); } Thanks for your help :confused: Rainer
Release and debug MFC use different and incompatible memory allocators. What you're seeing is a just result of that. You need to have all your modules built for the same mode (debug/release). --Mike-- http://home.inreach.com/mdunn/ The Signature, back by popular demand: Buffy. Pajamas.
-
Release and debug MFC use different and incompatible memory allocators. What you're seeing is a just result of that. You need to have all your modules built for the same mode (debug/release). --Mike-- http://home.inreach.com/mdunn/ The Signature, back by popular demand: Buffy. Pajamas.
Hello Mike, thanks a lot for your answer. :) So it looks like this is "by design" but not "by desire":(( . Because if you have several projects using some well tested "common dlls", you usually otherwise don't need these in debug and release mode, while debugging one of your apps. Rainer By the way: Thank you very much for your wonderfull tutorials ! ! ! !