C++;和C#IoT-C++;项目访问另一个项目中的C#DLL 我试图在C++中制作一个Windows IOT应用程序,在这里我也可以使用C代码。 我首先用VisualC++的Windows IOT核心控制台应用程序创建了一个解决方案。以下是入口点中的代码: // EnterPoint.cpp : Defines the entry point for the console application. // #include <iostream> #include "pch.h" #using <MainLogic.dll> int main(int argc, char **argv) { int result = MainLogic::StartupTask::Start(); std::cout << result << "\n"; }
我构建了C++项目,并添加了<>代码> \MaultLog\\bin \//Cudio >到参考目录和C/C++ ++ >使用C++项目的目录。 当我在具有x86体系结构的本地Windows调试器上运行时,它给出了一个错误:C++;和C#IoT-C++;项目访问另一个项目中的C#DLL 我试图在C++中制作一个Windows IOT应用程序,在这里我也可以使用C代码。 我首先用VisualC++的Windows IOT核心控制台应用程序创建了一个解决方案。以下是入口点中的代码: // EnterPoint.cpp : Defines the entry point for the console application. // #include <iostream> #include "pch.h" #using <MainLogic.dll> int main(int argc, char **argv) { int result = MainLogic::StartupTask::Start(); std::cout << result << "\n"; },c#,c++,.net,dll,iot,C#,C++,.net,Dll,Iot,我构建了C++项目,并添加了代码> \MaultLog\\bin \//Cudio >到参考目录和C/C++ ++ >使用C++项目的目录。 当我在具有x86体系结构的本地Windows调试器上运行时,它给出了一个错误: Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'MainLogic, Version=1.0.0.0, Culture=neutral, PublicK
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'MainLogic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
at main(Int32 argc, SByte** argv)
at _mainCRTStartup()
在生成的命令提示窗口中。这促使我放弃,我做到了。窗户上写着:
Unhandled exception at 0x75613E28 (KernelBase.dll) in PythonInCSharpInCPP.exe: 0xE0434352 (parameters: 0x80070002, 0x00000000, 0x00000000, 0x00000000, 0x72D60000).
我找到了最后一个地址(0x72D60000),在它的周围有一个文本“这个程序不能在DOS模式下运行”
<>我做了什么?你需要把C++项目作为一个依赖项添加到C++中。然后,当你构建C语言时,DLL将被复制到C++输出目录。
0x72D60000地址是加载DLL的基址。每个windows程序都从一个存根开始,存根上写着它不能在DOS模式下运行,以便在MS-DOS仍然与windows一起运行的年代使用。在Windows下运行时跳过该部分。我在Project->Project Dependencies中检查了MainLogic,但出现了错误。我在这里找到了答案:
Unhandled exception at 0x75613E28 (KernelBase.dll) in PythonInCSharpInCPP.exe: 0xE0434352 (parameters: 0x80070002, 0x00000000, 0x00000000, 0x00000000, 0x72D60000).