Z
Zach
I have both an unmanaged DLL written in C++, and a Windows Forms
application from which I'm trying to use the services of the unmanaged
DLL. I seem to have everything set up correctly, but I'd really like
to be able to debug into the unmanaged DLL. Here's how I have things
setup.
C++ file:
extern "C" {
DWORD_PTR __declspec(dllexport) TestFunction(LPCWSTR lpszParam);
}
DWORD_PTR __declspec(dllexport) TestFunction(LPCWSTR lpszParam)
{
OutputDebugString(L"Hello\n");
return -1;
}
C# file:
internal static class TestInterop
{
[DllImport("UnmanagedModule.dll")]
public extern static System.UIntPtr TestFunction(string Param);
}
internal class SomeOtherClass
{
public void InvokeTheMethod()
{
UIntPtr Handle = TestInterop.TestFunction("Hello");
}
}
When I step into TestInterop.TestFunction() i'd like to actually have
the debugger walk into my code. But, for whatever reason it doesn't
seem to be working. Oddly enough, in my Output window I don't see any
mention of the fact that it's loading my module or its symbols.
Moreover, the OutputDebugString() in my C++ code doesn't ever appear in
my output window either, the only way I know something is happening is
because I change change the value that gets returned in my C++ code,
and when I step over the function in C# the value is always whatever
I'm returning from the C++ code.
So, what is going on here? Is it even possible to debug across
managed/unmanaged boundaries? And why don't the OutputDebugString()
from unmanaged code show up in my output window?
Thanks
application from which I'm trying to use the services of the unmanaged
DLL. I seem to have everything set up correctly, but I'd really like
to be able to debug into the unmanaged DLL. Here's how I have things
setup.
C++ file:
extern "C" {
DWORD_PTR __declspec(dllexport) TestFunction(LPCWSTR lpszParam);
}
DWORD_PTR __declspec(dllexport) TestFunction(LPCWSTR lpszParam)
{
OutputDebugString(L"Hello\n");
return -1;
}
C# file:
internal static class TestInterop
{
[DllImport("UnmanagedModule.dll")]
public extern static System.UIntPtr TestFunction(string Param);
}
internal class SomeOtherClass
{
public void InvokeTheMethod()
{
UIntPtr Handle = TestInterop.TestFunction("Hello");
}
}
When I step into TestInterop.TestFunction() i'd like to actually have
the debugger walk into my code. But, for whatever reason it doesn't
seem to be working. Oddly enough, in my Output window I don't see any
mention of the fact that it's loading my module or its symbols.
Moreover, the OutputDebugString() in my C++ code doesn't ever appear in
my output window either, the only way I know something is happening is
because I change change the value that gets returned in my C++ code,
and when I step over the function in C# the value is always whatever
I'm returning from the C++ code.
So, what is going on here? Is it even possible to debug across
managed/unmanaged boundaries? And why don't the OutputDebugString()
from unmanaged code show up in my output window?
Thanks