Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 273079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:24:08+00:00 2026-05-12T00:24:08+00:00

I have been provided with a C++ DLL and associated header file in order

  • 0

I have been provided with a C++ DLL and associated header file in order to integrate it with my application. To begin with, I am simply trying to call the DLL from a simple Win32 console application (I’m using Visual Studio 2008 Express).

I’ve linked the DLL by specifying it as an additional dependency in the project settings.

The interface (i.e. the only exported function) simply returns a pointer to an instance of the Class that I actually need to call. I can successfully call this, get the pointer and call the first function that I need to (an “init” function).

When I come to call the function that actually does the processing I require, I’m intermittently getting a “0xC0000005: Access violation reading location….” error. That is, I run the program – it works successfully and exits – I try to run it again (changing nothing – all parameters are hard coded) and get the error (and continue to do so).

I can’t consistently recreate the problem but I’m beginning to think that it may be something to do with the DLL not being unloaded properly – after getting the error on one occasion I tried deleting the DLL and was told by Windows that it was in use. That said, on another occasion I was able to delete the DLL after getting the error, copy it back, then still got the error on the next run.

Should the DLL be correctly unloaded when my .exe finishes? Would I be better off trying to explicitly load/unload the DLL rather than doing it implicitly?

Any other help or advice greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:24:09+00:00Added an answer on May 12, 2026 at 12:24 am

    It won’t have anything to do with the DLL being unloaded; different processes using the same DLL do not share any state. Also, the DLL will be unloaded when the process exits; perhaps not gracefully, but it will be unloaded.

    I can think of two likely reasons for an intermittent failure.

    Most likely, the DLL has a race condition. This could be one that’s exposed if the DLL has been cached, causing the timing to change. That would explain why your first run didn’t fail but subsequent ones did.

    I think it’s also possible that the DLL didn’t release its lock on some file. If there is some file you know is accessed by this DLL, try checking to see if that file is locked after the process ends.

    Also, get this in a debugger. Turn on first-chance exceptions in visual studio and look at the callstack where the AV is happening, and post it here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 283k
  • Answers 283k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Several ways: Refactor repeated code into reuseable methods. Make use… May 13, 2026 at 4:13 pm
  • Editorial Team
    Editorial Team added an answer I'm not sure why you want to ban JOIN as… May 13, 2026 at 4:13 pm
  • Editorial Team
    Editorial Team added an answer GenericMeatUnit's answer didn't work for me, but it provided me… May 13, 2026 at 4:13 pm

Related Questions

I have a situation which I think I need the functionality provided by an
I have a third party .NET Assembly and a large Java application. I need
I've got a problem with a SOAP Web Reference that was generated by Visual
I'm at a loss to explain what seems to be mis-addressing within the char[]

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.