PDA

View Full Version : Qt Application linked to regular dll.....



Programm3r
9th February 2010, 12:32
Hi All.

I have a dll written in C++/MFC this is a regual dll dynamically linked to MFC.
I only linked the dll to my application QT, but when I close the application are reported several memory leaks.
This happens only lynching this type of DLL to Qt applications.

Any idea?

fmariusd
9th February 2010, 12:50
so u have a dll file that is a mfc -library? u don't clean up something in the mfc dll.

Programm3r
9th February 2010, 12:55
Thanks for your answer!

but ...

Does not allocate anything, I just lynched the dll to the application without any function call ... but in the process of issuing (exiting )....
Do not use the DLL lynx only

fmariusd
9th February 2010, 12:59
maybe u only linked the dll , u must include path to headers, too that's generally speaking. ....i don't know what development tools u use, system ... etc

Programm3r
9th February 2010, 13:09
right...:)
I use Microsfot Visual Studio 2003 on Windows XP professional 32bit Qt version 4.5.2
The header file, the. Lib is Ok otherwise not compile...:)
The problem is that only lynching the library at closing the application appear different memory leaks ... if the same library is created lynching MFC statically all back to work ... but I can not do

high_flyer
9th February 2010, 17:23
Does not allocate anything, I just lynched the dll to the application without any function call ...
This is not true.
If your application link against the DLL at run time, then the DLLMain() of your DLL gets called, and there you are very probably allocating memory (of not directly, then indirectly).

high_flyer
9th February 2010, 17:23
(double post deleted)

Programm3r
10th February 2010, 07:37
this is not true.....:)

Is a regular DLL not an extension DLL....
There is not DllMain...but InitInstance and ExitInstance...

<CODE>
BOOL CToolsApp::InitInstance()
{
CWinApp::InitInstance();

// any DLL initialization goes here
TRACE0("TOOLS.DLL REGULAR Initializing\n");

// Creazione COleDataObject generale
m_pOleDataObject = new COleDataObject();

return TRUE;
}

int CToolsApp::ExitInstance()
{

// Libero l'OleDataObject
if( m_pOleDataObject != NULL ) {
m_pOleDataObject->Release();
delete m_pOleDataObject;
m_pOleDataObject = NULL;
}

TRACE0("TOOLS.DLL REGULAR Exit\n");

return CWinApp::ExitInstance();
}
</CODE>

The problem appears only when this dll is dynamically linked to MFC, when this dll is statically linked to MFC ....everything works fine...
I presume that when these linked dynamically is done first check the memory leaks and after releasing the memory .... or something :(

Thanks anyway for replying :)