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++ / December 2006

Tip: Looking for answers? Try searching our database.

Attempted to read or write protected memory.  Exception in release build, instantiating unmanaged class.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruce - 31 Dec 2006 04:36 GMT
I am getting the following exception in the release build of my assembly.

{"Attempted to read or write protected memory. This is often an
indication that other memory is corrupt."}    System.Exception
{System.AccessViolationException}

I do not have any problems in debug.  The problem occurs while
instantiating an unmanaged class.

Any idea what is causing the problem?   Why would I get the problem in
release but not debug?

I have included the wrapper managed class below. The unmanaged class
GarXface4::UsbDeviceNameList enumerates USB devices using functions
found in Setupapi.  The class works fine when called with unmanaged code.

public ref class UsbNames
{
public:
    UsbNames()
    {
        m_pLst = new GarXface4::UsbDeviceNameList();
    }

    ~UsbNames()
    {
               
        delete m_pLst;
    }

private:

    GarXface4::UsbDeviceNameList *m_pLst;
};

Signature

Bruce E. Stemplewski
GarXface OCX and C++ Class Library for the Garmin GPS
www.stempsoft.com

Bruce - 31 Dec 2006 05:02 GMT
Never mind, I got this working.  Just needed to recompile the unmanaged
class's static lib.

Signature

Bruce E. Stemplewski
GarXface OCX and C++ Class Library for the Garmin GPS
www.stempsoft.com


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.