I am trying to make an unmanaged DLL for Unity, which should be able to communicate with a “server “ object in Bio-Explorer.
I tested the example application (BETestClient) provided with BioExplorer, which communicates with the Server object via TCP-IP, and was able to change and compile this application successfully with Visual Studio (Community 2017).
Now I want to encode the same functionality in a DLL which should be included in a Unity project. I made a DLL based on https://ericeastwood.com/blog/17/unity-and-dlls-c-managed-and-c-unmanaged.
The DLL is correctly included in Unity, but fails in CoInitialize. Since I assumed that it was related to threading (I read somewhere that when you use CoInitialize, the DLL must be a separate thread). So I tried to build a DLL based on http://www.chadweisshaar.com/blog/2015/07/02/microsoft-speech-for-unity/ (since it uses CoInitialize and threading). However, still the CoInitialize function fails. The numeric value of the FAILED HResult is 0x80040154, which according to https://support.microsoft.com/en-us/help/201191/you-receive-a-0x80040154-class-not-registered-error-message-when-you-r is a “class not registered “ error for ATL70.dll. I tried to install ATL70.dll in Windows/system32 and register ATL.dll with Regsvr32.exe, but that does not help.
So…what to do next?
(I included the (yet incomplete) Visual Studio project and Unity package)
3501415–279134–BioDLL.unitypackage (15.1 KB)
3501415–279135–TestBioDLL.zip (3.19 MB)