Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / January 2005

Tip: Looking for answers? Try searching our database.

Problem in the calling the dll functions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ashutosh - 11 Jan 2005 13:16 GMT
hi,

i am making the dll  for clamav antivirus libraray  so that i can make
activex control for windows.

i complied the library successfully and make the Libclamav.dll file using
win32 Api project in debug mode.

this dll file exports all the 21 function which is needed for clamscan.

now i am making the MFC project in which i am calling these function.

the function in which  i am loading the database dir crash with the

Error Message : Unhandled exception at 0x0008686a in export.exe: 0xC0000005:
Access violation reading location 0x0008686a.

note: here export.exe is my program executable file.

Please help me to sort out the problem . i want to know :
a. where is the actual problem?
 In the application program or in the dll

what should be the approach to find out the error . i am new in the vc++
programing  environment. so please try to give me detail information about
this problem.
Oleg Starodumov - 11 Jan 2005 14:35 GMT
> Error Message : Unhandled exception at 0x0008686a in export.exe: 0xC0000005:
> Access violation reading location 0x0008686a.

Here are some possible reasons:
1) Buffer overwrite in a function (thus jumping to incorrect address when returning;
   check arrays declared as local variables and make sure that the code does not write
   past their boundaries)
2) Function call through an invalid pointer
3) Heap corruption
4) Some other reasons are possible, but less likely

> what should be the approach to find out the error

Try to step through the code in the debugger, it is very likely
that you will find the problem this way. If you attached the debugger
only after the exception, check the call stack - it can tell what functions
were called recently (though it is possible that the call stack will not be available).

Also, since you write the code, use tracing and insert as many trace statements
into the application and the DLL as possible (at least, trace all function calls).
The trace log will tell you what functions have been executing just before
the problem occurred, therefore you will know where to look for the problem.
You can use OutputDebugString, TRACE, ATLTRACE, or other tracing libraries
(e.g. see CodeGuru.com).

Check that all DLL functions are properly declared, and the declarations
are up-to-date in the DLL and in the client application.
Make sure that the up-to-date version of the DLL is used
(check the location it is loaded from).

If you use VS.NET, make sure that /RTC1 and /GS compiler options are enabled.

If you call functions through pointers, verify all pointers before calling the functions.

If it does not help, there are other approaches that can be applied.

Regards,
Oleg

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.