问题
In a C# app, I'm referencing a native C static lib, that I wrapped in a C++/CLI DLL. I chose a static lib versus a DLL because I have other constraints related to the release process of the app to the user. Among the many topics available on this forum I found the following implementation.
Main :
{
MyCLRDLL test = new MyCLRDLL();
if(test.go()) Console.WriteLine("Hello, wrld");
}
In the DLL project, the file MyCLRDLL.hpp
#include "MyNativeLib.h"
#pragma comment(lib, "MyNativeLib.lib")
namespace InteropTest {
public ref class MyCLRDLL
{
CMyNativeLib* mInt ;
public:
MyCLRDLL() { mInt = CMyNativeLib_New() ;} ;
~MyCLRDLL() { CMyNativeLib_Delete(mInt) ;} ;
bool go() { return mInt->areYouThere() ;} ;
};
}
And in the native project, MyNativeLib.h
namespace InteropTest
{
class __declspec(dllexport) CMyNativeLib
{
public:
CMyNativeLib() {};
~CMyNativeLib(){};
bool areYouThere() ;
} ;
extern "C" __declspec(dllexport) CMyNativeLib* CMyNativeLib_New();
extern "C" __declspec(dllexport) void CMyNativeLib_Delete(CMyNativeLib* pLib);
}
and MyNativeLib.cpp
#include "MyNativeLib.h"
namespace InteropTest {
extern "C" __declspec(dllexport) CMyNativeLib* CMyNativeLib_New(){return new CMyNativeLib() ;}
extern "C" __declspec(dllexport) void CMyNativeLib_Delete(CMyNativeLib* pLib){delete pLib;}
bool CMyNativeLib::areYouThere() { return true ; }
}
The debugger is not stepping into mInt->areYouThere() function. Why is that so? Breakpoints in the native part are not caught either.
Symbols are loaded for MyCLRDLL, "Enable unmanaged code debugging" is active on C# project, "Debugging/Debugger Type" is set to Mixed for both C projects and in the general options, most relevant things seem checked.
Does it mean that the MyCLRDLL.pdb file does not contain the debug information from the lib code? How to check?
(possible same question as unanswered Debugging an unmanaged C++ static lib included in a CLR .dll)
来源:https://stackoverflow.com/questions/22661185/debugger-does-not-step-into-native-code-when-debugging-a-static-lib-wrapped-in-a