簡體   English   中英

從另一個dll調用函數時,DLL變得無法加載

[英]Dll become unable to load when calling function from another dll

現在,我有一個Unity(C#)項目,該項目從dll調用我的C ++項目。 它們都工作正常,因此可以從Unity調用C ++函數。

但是,當我嘗試在C ++項目中添加一行以調用函數的另一個庫(NLOpt庫,來自另一個dll)時,生成的dll變得無法加載到Unity項目中。

Plugin.h

extern "C" __declspec(dllexport) bool __stdcall LoadData(int agent_num, int frame_num, float* data);

Plugin.cpp

#include "Plugin.h"
#include <nlopt.h>
__declspec(dllexport) bool __stdcall LoadData(int agent_num, int frame_num, float* d)
{
    ...
    nlopt_opt opt = nlopt_create(NLOPT_LN_COBYLA, 3); //this line
}

當我在上面添加行時,Unity將出現以下錯誤:

Plugins: Failed to load 'Assets/Plugins/BirdOpti/BirdOpti.dll'

DllNotFoundException: Opti

我已經嘗試了幾次,所以我確定問題出在線路上。

我做錯了嗎?

將使用過的dll文件也添加到插件目錄即可解決該問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM