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 8187363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:32:18+00:00 2026-06-07T02:32:18+00:00

I have a managed C++ dll which is used as a EEAddIn for Visual

  • 0

I have a managed C++ dll which is used as a EEAddIn for Visual Studio debugger. My dll exports one function accepting and returning unmanaged types. The declaration of the function in the dll is as follows (DEBUGHELPER is a plain structure):

extern "C" 
{
#pragma unmanaged
  __declspec(dllexport) HRESULT CvMatViewer(DWORD dwAddress, DEBUGHELPER *pHelper, 
    int nBase, BOOL bUniStrings, char *pResult, size_t max, DWORD reserved)
  {
    strcpy_s(pResult, max, "Value is processed");
    return S_OK;
  }
}

The purpose of my dll is to handle variables from Visual Studio debugger and to format them in arbitrary way prior to displaying in Watch Window (that what EEAddIn is for, pretty cool).

I have two Visual Studios launched – one for my managed dll and one for native debugged exe. I can attach my dll to the process of the Visual Studio running native exe and set a breakpoint. When user adds variable in the Watch window, my breakpoint is hit. I can see that all parameters is passed correctly and function works fine till the return statement is reached.

After that, I have an Unhandled exception at 0x51ea9de4 in devenv.exe: 0xC0000005: Access violation reading location 0x00000000.

The same works fine for unmanaged dlls. So can anyone guess where the problem hides?

Both Visual Studios are of 2010 version.

Yes, I can use unmanaged dll to accept this call and then pass control to another managed dll, but the Occam’s razor principle tells me not to do that.

Update:
pResult is not a NULL, and exception is thrown even if I comment strcpy_s out.

  • 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-06-07T02:32:20+00:00Added an answer on June 7, 2026 at 2:32 am

    It looks like you have to set stdcall calling convention on this function explicitly, this should help.

    __declspec(dllexport) HRESULT __stdcall CvMatViewer(DWORD dwAddress, DEBUGHELPER *pHelper, 
        int nBase, BOOL bUniStrings, char *pResult, size_t max, DWORD reserved);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a situation in which a managed DLL calls some unmanaged DLL. I
Suppose we have an unmanaged process which loads a managed DLL. Within the DLL
I have managed to develop an extension for visual studio Update web reference action
I have a c# windows app that calls a managed c++ dll, which, in
I have a C++ dll (specifically a directshow filter) which is being used in
I have a managed class library (say mylib.dll) and a 3rd party managed app
I have successfully implemented interop beftween Win32 application and managed .Net dll as described
Setup: I have a COM DLL that calls a method inside a managed C#
I have managed to create a custom action in C# using MakeSfxCA which is
I have a C++ DLL which has a constant defined as such: #define GPC_EPSILON

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.