Calling C++ from C#. Method runs OK, but I can't step into it to debug. It shows the disassembly screen and says source code not available. Any ideas?
Code below, in case it helps...
using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace ConsoleApplication1 { class Program { [return: MarshalAs(UnmanagedType.I4)] [DllImport("ClassLibrary1.dll", SetLastError = true)] static extern int DoSomething(); static void Main(string[] args) { int x = DoSomething(); Console.WriteLine(x.ToString()); Console.ReadKey(); } } }
#pragma once using namespace System; namespace ClassLibrary1 { __declspec(dllexport) int DoSomething(); } // This is the main DLL file. #include "stdafx.h" #include "ClassLibrary1.h" int DoSomething() { return 3; }