Unable to find an entry point when calling C++ dll in C#
问题 I am trying to learn P/Invoke, so I created a simple dll in C++ KingFucs.h: namespace KingFuncs { class KingFuncs { public: static __declspec(dllexport) int GiveMeNumber(int i); }; } KingFuns.cpp: #include "KingFuncs.h" #include <stdexcept> using namespace std; namespace KingFuncs { int KingFuncs::GiveMeNumber(int i) { return i; } } So it does compile, then I copied this dll into my WPF's debug folder, with code: [DllImport("KingFuncDll.dll", EntryPoint = "GiveMeNumber", SetLastError = true,