Re: Access Violation using CCriticalSection in DLL

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



(a) show the code, including the declarations of all variables involved
(b) precisely where does the access violation happen (it doesn't happen "in the DLL", it
happens at a specific line of code somewhere!)
(c) what is the call stack when the access violation happens? Show the lines of code and
values at the point where your code invokes whatever operation is causing the access
fault.
joe

On Sat, 7 Apr 2007 09:27:56 -0600, "Brian Westcott" <bwestcott@xxxxxxx> wrote:

I have a log program that uses a CRiticalSection to synchronize writes to
the log file. It works OK in most of my programs. When I Load a DLL (That I
wrote) , I pass the address of the log program by reference to the DLL. When
I call the log program from within the DLL, I get an access violation when
the log program calls CCriticalSection::Lock after formatting the data to be
logged. When I compile and test all programs in Debug mode, the log program
works OK.
I am declaring the logger outside of the scope of my main program so
presumably that makes it global?
Can anyone tell me what is going on?

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • R e: Catching access violation exceptions
    ... >> exception handling support. ... >> option enables Microsoft's Structured Exception Handling in ... >> EH so that a catch will catch an access violation. ... least attempt to disable that DLL from being used the next time. ...
    (comp.lang.cpp)
  • Re: VerQueryValue() problem
    ... Do you get an access violation? ... > afterwards I query the version information of the DLL and I am running into> the problem, that VerQueryValue() fails on some systems and runs OK on> others for the same DLL. ... > My eMail-address has been changed due to spam. ...
    (microsoft.public.win2000.developer)
  • Re: Sockets in a DLL, access violation
    ... I don't believe it is a multiple thread problem. ... Jon Harris wrote: ... me the access violation, AFX_MANAGE_STATE is being executed. ... Have you added this code to the beginning of all our DLL exported functions? ...
    (microsoft.public.vc.mfc)
  • Re: Sockets in a DLL, access violation
    ... I initially had a problem when I wasn't doing this with assertions ... me the access violation, AFX_MANAGE_STATE is being executed. ... Have you added this code to the beginning of all our DLL exported functions? ... how can I write my sockets code ...
    (microsoft.public.vc.mfc)
  • Access Violation using CCriticalSection in DLL
    ... I have a log program that uses a CRiticalSection to synchronize writes to ... the log file. ... When I Load a DLL (That I ...
    (microsoft.public.vc.mfc)