Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/125.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何构建c++;在unity/c中导入的dll# 我想建立一个C++ DLL,但是我发现我的DLL可能有问题。我刚刚为ARM64构建了一个简单的函数,将其部署到Hololens2中。 header.h文件: #include "pch.h" #ifdef MYRESEARCHMODE_EXPORTS #define DllExport __declspec(dllexport) #else #define DllExport _declspec(dllimport) #endif #ifdef _cplusplus extern "C" { #endif class DllExports { public: DllExport static int __stdcall DOUT(); }; #ifdef _cplusplus } #endif The .cpp file like this: #define MYRESEARCHMODE_EXPORTS #include "pch.h" #include"myResearchMode.h" int __stdcall DllExports::DOUT() { return 123; }_C#_C++_Unity3d_Dll_Hololens - Fatal编程技术网

C# 如何构建c++;在unity/c中导入的dll# 我想建立一个C++ DLL,但是我发现我的DLL可能有问题。我刚刚为ARM64构建了一个简单的函数,将其部署到Hololens2中。 header.h文件: #include "pch.h" #ifdef MYRESEARCHMODE_EXPORTS #define DllExport __declspec(dllexport) #else #define DllExport _declspec(dllimport) #endif #ifdef _cplusplus extern "C" { #endif class DllExports { public: DllExport static int __stdcall DOUT(); }; #ifdef _cplusplus } #endif The .cpp file like this: #define MYRESEARCHMODE_EXPORTS #include "pch.h" #include"myResearchMode.h" int __stdcall DllExports::DOUT() { return 123; }

C# 如何构建c++;在unity/c中导入的dll# 我想建立一个C++ DLL,但是我发现我的DLL可能有问题。我刚刚为ARM64构建了一个简单的函数,将其部署到Hololens2中。 header.h文件: #include "pch.h" #ifdef MYRESEARCHMODE_EXPORTS #define DllExport __declspec(dllexport) #else #define DllExport _declspec(dllimport) #endif #ifdef _cplusplus extern "C" { #endif class DllExports { public: DllExport static int __stdcall DOUT(); }; #ifdef _cplusplus } #endif The .cpp file like this: #define MYRESEARCHMODE_EXPORTS #include "pch.h" #include"myResearchMode.h" int __stdcall DllExports::DOUT() { return 123; },c#,c++,unity3d,dll,hololens,C#,C++,Unity3d,Dll,Hololens,我使用Dumpbin测试它是否成功构建。 然后我在Unity/Plugin中导入它 [DllImport("myResearchMode.dll", EntryPoint = "?DOUT@DllExports@@SAHXZ ", CallingConvention = CallingConvention.Cdecl)] public static extern int DOUT(); 但是我发现结果没有显示出来。我想我的dll有问题,

我使用Dumpbin测试它是否成功构建。 然后我在Unity/Plugin中导入它

    [DllImport("myResearchMode.dll", EntryPoint = "?DOUT@DllExports@@SAHXZ  ", CallingConvention = CallingConvention.Cdecl)]
    public static extern int DOUT();

但是我发现结果没有显示出来。我想我的dll有问题,我忘了为它设置一些设置吗?或者错误在哪里?

< P>你是如何创建C++ DLL的?当在VisualStudio中创建C++ DLL时,您选择哪个项目模板作为脚手架?如果您将C++ DLL创建为Win32二进制,则在HeloLeS2上运行时会抛出异常,因为UNIX在构建WSA项目时不会包含标准的Win32二进制文件。因此,建议重新创建或将本机win32 DLL移植到UWP DLL,请参阅此处的指南:

我建议首先查看是否可以在本地运行DLL的windows\linux变体。然后在您的目标设备上尝试官方示例:一旦两者都起作用,您就可以调查它们之间的差异以及您可能缺少的内容。