These are chat archives for CoraleStudios/Colore

5th
Oct 2015
Callum Morris
@CaLxCyMru
Oct 05 2015 17:51
This message was deleted
Jerrith2
@Jerrith2
Oct 05 2015 21:43
Minor / Slightly misleading: On systems without the SDK installed: In NativeMethods(), the call to Native.Kernel32.NativeMethods.LoadLibrary will result in a System.DllNotFoundException, rather than a ColoreException. (Having looked at the code a few lines down, I was expecting the ColoreException, not the DllNotFound one.)
Adam Hellberg
@Sharparam
Oct 05 2015 21:45
@Jerrith2 Are you sure you're not using the x86 or x64 build of Colore? LoadLibrary will never throw an exception since it's a native function and will simply return a NULL pointer (IntPtr.Zero) if the requested library was not found.
Jerrith2
@Jerrith2
Oct 05 2015 22:10
Ah, that could explain it. I switched from an Any CPU build to using x86 and x64 builds because Any CPU wasn't working for me when run in the 32 bit Unity Standalone Player (crashed).
Yes, you're right, that's inside the #if ANYCPU block.
My fault, I should have scrolled up and checked.
Is there a preferred method of detecting if the DLL is present in x86 / x64 builds? I've just wrapped all my code in try / catch, looking for the DllNotFoundException.
Adam Hellberg
@Sharparam
Oct 05 2015 22:17
The DllNotFoundExceptions are from the DllImport attributes not finding the DLLs, one could still use LoadLibrary to attempt loading them and check the return and/or Marshal.GetLastWin32Error. Or wrap the first call to a Colore method with a try-catch. We might add a check on the first initialization of Colore to see if a DLL error is thrown and if so re-throw as a ColoreException. The bool Chroma.IsSdkAvailable() is also being added which can be used to check availability of the Chroma SDK on the system.
CoraleStudios/Colore#71 Scheduled for release in 2.3
Jerrith2
@Jerrith2
Oct 05 2015 22:29
Sounds good. Chroma.IsSdkAvailable() is the elegant solution I was hoping for, but try-catch works for now. Thanks again.