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

  • Home
  • SEARCH
  • 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
  • 1 View
  • 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

Related Questions

I have been provided an XSD and a sample Xml file that contains the
Have been trying to encrypt an xml file to a string so that I
I have been provided with an unmanaged C++ DLL that contains several classes. I
I have tried all the solutions that have been provided including using PRAGMA but
I have to populate a shop's images and been provided with folders of images
My web designer has provided me with updated fonts/icons that have been added to
I have been attemptng to create a DLL with C/C++ that can be accessed
I have been trying to teach myself MEF, starting with this tutorial: http://blogs.msdn.com/b/brada/archive/2008/09/29/simple-introduction-to-composite-applications-with-the-managed-extensions-framework.aspx There
I've been trying to run the sample project provided with the tutorial at stockbotprogramming
I have a solution file ( i.e DLL file). i want to create webservice/WCF

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.