Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple test app crashes on exit after loading dll

Status
Not open for further replies.

snuv

Programmer
Oct 30, 2001
751
GB
When the code is run in debug, there is an access violation error in the doexit() function is called for the dll.
The "if (false)" block is optimised out in relase but taking out the "if" clause will cause it to reappear

Code:
#include "stdafx.h"
#include <CMyHeader.H>

int main(int argc, char* argv[])
{
	HSAMPLE hTest;
	if (false)
	{
		MyRoutine(&hTest;, "testSystem");
	}
	return 0;
}
CMyHeader.h contains the function calls available in CMyHeader.dll

StackTrace
Code:
1e000041()
10000041()
$E40() + 13 bytes
doexit(int 0, int 0, int 1) line 353
_cexit() line 294 + 11 bytes
_CRT_INIT(void * 0x10000000, unsigned long 0, void * 0x00000001) line 157
_DllMainCRTStartup(void * 0x10000000, unsigned long 0, void * 0x00000001) line 252 + 17 bytes
NTDLL! 77f830e7()
NTDLL! 77f8ee02()
KERNEL32! 7c580ed2()
doexit(int 0, int 0, int 0) line 392
exit(int 0) line 279 + 13 bytes
mainCRTStartup() line 212
KERNEL32! 7c581af6()

This didnt happen when the dll was compiled and linked with VC4.2 but has happened since it was upgraded to VC6.

It maybe that there a setting I have missed in VC6 that will correct this.

Can anyone give me any pointers?
Thanks in advance


"If it could have gone wrong earlier and it didn't, it ultimately would have been beneficial for it to have." : Murphy's Ultimate Corollary
 
It really depends on what MyRoutine does. It may be an illegal delete/free. BTW, you have a spurious ; in your code in the parameters.

Have a look at There are a load of routines which you can liberally scatter all over your code to track down the fault.

It is possible that the fault has been there all the time: just that the older compiler allowed you to get away with it but the new one won't. Happens on every system: Unix, Linux, RMX, VMS etc.
 
Thanks for the link and pointing out the extra ;

I will give the _CrtCheckMemory a try.


"If it could have gone wrong earlier and it didn't, it ultimately would have been beneficial for it to have." : Murphy's Ultimate Corollary
 
after some more thought

It can't be an illegal delete/free as no functions in the dll are called

It must be something that the dll is doing when its loaded or deleted

any clues?

"If it could have gone wrong earlier and it didn't, it ultimately would have been beneficial for it to have." : Murphy's Ultimate Corollary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top