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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem calling DLL functions when built in release mode

Status
Not open for further replies.

CMR

Programmer
Apr 30, 2002
76
AU
I have a handful of MFC applications that connect to a database using ODBC (Informix, at the moment). The system I'm working on has it's own simple security system, the usernames and passwords are stored in the database and checked when the user logs in. Because I'm developing several small applications, I put the Login function into a DLL, which will show a dialog box asking for the username and password if required.
Now here's the funny thing: when I run the application in Debug mode, and the DLL has been built in debug mode, everything works fine; also if both the app and the DLL have been built in release mode it all works fine. However, if the DLL has been build in release mode, and the app is run in debug, I get a "user breakpoint called from 0x..." error.
Similarly, if the DLL has been build in debug and I run a release build of the app, I get an assertion failure in "dbgheap.c" at the expression _CrtlsValidHeapPointer(pUserData) and it won't let me go any further.

I don't have a great deal of experience in writing DLLs so it's possible that I've just done something really daft, but I think it's strange that it works if both the app and the DLL have been built in the same mode. Maybe I'm not initialising something properly but the error information isn't very helpful.

If anyone has seen this kind of thing before, or can tell me where I should start looking I'd be very grateful.

thanks in advance

CMR
 
That's normal. When you make an MFC based .dll, the release mode only works with a release application and the debug only with a debug application.

I wrote three tutorials on MFC .dlls which are posted on CodeGuru: Article 1 explains how this works.

Good luck.
 
Thanks very much, at least I know I don't need to worry about it.

I'll check out your tutorials too, I daresay I could learn a few things.

thanks again.

CMR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top