访问冲突Unity DLL插件Pocketsphinx

时间:2017-08-07 19:55:04

标签: unity3d dll pocketsphinx

问题:加载本机插件时Unity崩溃。

目标:在Unity中使用Pocketsphinx - Windows。 libpocketsphinxwrap.dll是pocketsphinx.dll和sphinxbase.dll的接口。

到目前为止:

我完美地编译了Sphinxbase和Pocketsphinx项目。然后我在Visual Studio中创建了一个名为libpocketsphinxwrap的项目,它在LINKING上查找sphinxbase.lib,pocketsphinx.lib。没有任何问题,DLL已构建。

在Unity中,我添加了所有三个插件,libpocketsphinxwrap.dll,sphinxbase.dll和pocketsphinx.dll。将它们设置为正确的平台(我在release / x64和Windows 8.1 SDK中构建了所有平台)。

在运行时,Unity因dll sphinxbase上的“访问冲突”而崩溃。以下是Editor.log和crash.log文件:

========== OUTPUTING STACK TRACE ==================

0x00000000378FF725 (pocketsphinx) [c:\users\fgera\development\tools\cmusphinx\pocketsphinx\src\libpocketsphinx\pocketsphinx.c:936] ps_start_utt 
0x00007FFEEB981B09 (libpocketsphinxwrap) [c:\users\fgera\development\tools\cmusphinx\libpocketsphinxwrap\src\pocketsphinx.c:1360] CSharp_Pocketsphinx_Decoder_StartUtt 
0x000000003801A594 (Mono JIT Code) (wrapper managed-to-native) Pocketsphinx.PocketSphinxPINVOKE:Decoder_StartUtt (System.Runtime.InteropServices.HandleRef)
0x000000003801A43D (Mono JIT Code) [C:\Users\fgera\Development\Git\Computer-Graphics\Motional.AI\Assets\Libraries\Pocketsphinx\Wrappers\Decoder.cs:99] Pocketsphinx.Decoder:StartUtt () 
0x0000000038011E75 (Mono JIT Code) [C:\Users\fgera\Development\Git\Computer-Graphics\Motional.AI\Assets\Scripts\NPC\NPC Modules\Audio_Listener_Module\NPCAudioListener.cs:226] NPCAudioListener:InitLocalTranscriber () 
0x000000003800BC4A (Mono JIT Code) [C:\Users\fgera\Development\Git\Computer-Graphics\Motional.AI\Assets\Scripts\NPC\NPC Modules\Audio_Listener_Module\NPCAudioListener.cs:132] NPCAudioListener:InitializeModule () 
0x0000000038001C67 (Mono JIT Code) [C:\Users\fgera\Development\Git\Computer-Graphics\Motional.AI\Assets\Scripts\NPC\NPC Agent\NPCController.cs:192] NPC.NPCController:LoadNPCModules () 
0x000000003800099C (Mono JIT Code) [C:\Users\fgera\Development\Git\Computer-Graphics\Motional.AI\Assets\Scripts\NPC\NPC Agent\NPCController.cs:280] NPC.NPCController:Awake () 
0x000000000B5D7392 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFE91635B63 (mono) [c:\buildslave\mono\build\mono\mini\mini.c:4937] mono_jit_runtime_invoke 
0x00007FFE9158872D (mono) [c:\buildslave\mono\build\mono\metadata\object.c:2623] mono_runtime_invoke 
0x000000014140A365 (Unity) scripting_method_invoke
0x0000000141402311 (Unity) ScriptingInvocation::Invoke
0x000000014140486E (Unity) ScriptingInvocation::InvokeChecked
0x0000000141159894 (Unity) MonoBehaviour::CallMethodInactive
0x0000000141159DCD (Unity) MonoBehaviour::CallAwake
0x0000000141172C6F (Unity) MonoBehaviour::AddToManager
0x000000014115ACA2 (Unity) MonoBehaviour::AwakeFromLoad
0x0000000141427491 (Unity) AwakeFromLoadQueue::InvokePersistentManagerAwake
0x00000001414301B9 (Unity) AwakeFromLoadQueue::PersistentManagerAwakeFromLoad
0x00000001413C8117 (Unity) LoadSceneOperation::CompleteAwakeSequence
0x00000001413C85FA (Unity) LoadSceneOperation::CompletePreloadManagerLoadSceneEditor
0x00000001413CCE03 (Unity) LoadSceneOperation::IntegrateMainThread
0x00000001413CBCA8 (Unity) PreloadManager::UpdatePreloadingSingleStep
0x00000001413CBE48 (Unity) PreloadManager::WaitForAllAsyncOperationsToComplete
0x00000001406E72C5 (Unity) EditorSceneManager::RestoreSceneBackups
0x000000014012C165 (Unity) Application::EnterPlayMode
0x000000014012D307 (Unity) Application::SetIsPlaying
0x0000000140130B72 (Unity) Application::TickTimer
0x0000000141A87E5D (Unity) MainMessageLoop
0x0000000141A89827 (Unity) WinMain
0x0000000141CEC8BC (Unity) __tmainCRTStartup
0x00007FFEF0772774 (KERNEL32) BaseThreadInitThunk
0x00007FFEF3270D51 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========

error.log中

Unity Editor [version: Unity 2017.1.0f3_472613c02cf7]

pocketsphinx.dll caused an Access Violation (0xc0000005)
  in module pocketsphinx.dll at 0033:378ff725.

Error occurred at 2017-08-07_153424.
C:\Program Files\Unity\Editor\Unity.exe, run by fgera.
46% memory in use.
16276 MB physical memory [8663 MB free].
19220 MB paging file [9598 MB free].
134217728 MB user address space [134214536 MB free].
Read from location 00000010 caused an access violation.

Context:
RDI:    0x3c4c4c68  RSI: 0x0b5d7290  RAX:   0x66bbca20
RBX:    0x3d1d58e0  RCX: 0x00000000  RDX:   0x7bda7348
RIP:    0x378ff725  RBP: 0x005fd500  SegCs: 0x00000033
EFlags: 0x00010202  RSP: 0x005fd370  SegSs: 0x0000002b
R8:    0x00000000  R9: 0x00000000  R10:   0x3d1c5650
R11:    0xeb981af0  R12: 0x005fdca8  R13:   0x20e367f8
R14:    0x005fdd20  R15: 0x00000000

Bytes at CS:EIP:
48 8b 41 10 48 8b f9 0f b6 90 b8 00 00 00 fe ca 


Module 1
C:\Program Files\Unity\Editor\OpenRL_pthread.dll
Image Base: 0x80000000  Image Size: 0x0000f000
File Size:  42496       File Time:  2017-07-07_082120

Module 2
C:\Program Files\Unity\Editor\FreeImage.dll
Image Base: 0x80000000  Image Size: 0x005e0000
File Size:  6125568     File Time:  2017-07-07_082140


Module 3
C:\Users\fgera\Development\Git\Computer- Graphics\Motional.AI\Assets\Libraries\Pocketsphinx\x86_64\sphinxbase.dll
Image Base: 0x80000000  Image Size: 0x0004c000
File Size:  284160      File Time:  2017-08-07_151352

Module 4
C:\Users\fgera\Development\Git\Computer-Graphics\Motional.AI\Assets\Libraries\Pocketsphinx\x86_64\pocketsphinx.dll
Image Base: 0x80000000  Image Size: 0x00041000
File Size:  251904      File Time:  2017-08-07_151540


Module 5
C:\Windows\SYSTEM32\xinput1_3.dll
Image Base: 0x00400000  Image Size: 0x0001e000
File Size:  107368      File Time:  2007-04-04_185422

Module 6
C:\Windows\SYSTEM32\MSVCP100.dll
Image Base: 0x63a40000  Image Size: 0x00098000
File Size:  608080      File Time:  2011-02-20_015156

Module 7
C:\Windows\SYSTEM32\MSVCR100.dll
Image Base: 0x63bc0000  Image Size: 0x000d2000
File Size:  829264      File Time:  2011-02-19_035232

== [end of error.log] ==

dll的签名定义示例

 [global::System.Runtime.InteropServices.DllImport("libpocketsphinxwrap", EntryPoint="CSharp_Pocketsphinx_FrontEnd_ProcessUtt")]
 public static extern int FrontEnd_ProcessUtt(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, uint jarg3, global::System.Runtime.InteropServices.HandleRef jarg4);

0 个答案:

没有答案