【发布时间】:2019-02-22 12:25:27
【问题描述】:
目前我正在尝试将CEF 嵌入到 Unity 中。我已经设法将 cefsimple 示例编译为 dll,并通过使用 DllImport 和以下代码在普通控制台应用程序中使用它:
[DllImport("cefsimple")]
public static extern ulong StartCustom();
static void Main(string[] args)
{
StartCustom();
}
及对应的C函数:
extern "C" __declspec (dllexport) int StartCustom() {
return wWinMain(nullptr, nullptr, nullptr, 0);
}
(我已将所有必要的文件移动到包含已创建 .exe 文件的文件夹中)
但如果我尝试在 Unity 中做同样的事情,我会得到 p>
Failed to load 'Assets/Plugins/cefsimple.dll' with error 'The specified procedure could not be found.
DllNotFoundException: cefsimple
Launcher.Init () (at Assets/Plugins/Launcher.cs:13)
有什么办法可以解决这个问题吗?
【问题讨论】:
-
Assets/Plugins/cefsimple.dll看起来像一个相对路径,DllNotFoundException看起来像找不到 DLL 本身...你能设置一个绝对路径来检查吗? -
另一条线索:您的 dll 是否与未复制到同一目录中的其他 dll 有依赖关系?
-
感谢您的快速回答。我尝试替换路径并收到以下错误:
DllNotFoundException: C:\Users\rstoliar\Documents\CefExample\Assets\Plugins\cefsimple。但是第一个错误(Failed to load 'Assets/Plugins/cefsimple.dll' with error 'The specified procedure could not be found)消失了。 -
我复制了与普通控制台应用程序相同的文件。
-
绝对是依赖 DLL 问题。尝试使用依赖漫游器工具打开您的 DLL,看看缺少哪些。