For the project I am working on we have written a very simple Optix Prime program that calculates the intersection of a triangulated model and a bunch a lines for a non-raytracing application. The program works great and we get awesome performance.
Now we need to be able to call the c++ Optix Prime function from C#. Since the code is pretty simple I am trying to do this using DllImport, however no matter what I try I cannot get the dll for the Optix Prime program to import in C#, I always get the error: “Unable to load DLL ‘primeSimplePP.dll’: The specified module could not be found. (Exception from HRESULT: 0x8007007E).” I have made sure that the dll is in the output directory of the C# project and I used dependency walker to see what else the dll is dependant on. Dependency walker shows that my dll (which is really just a modification of the primeSimplePP example) depends on SUTIL.DLL and OPTIX-PRIME.1.DLL as well as well as MSVCP120.DLL, MSVCR120.DLL, and KERNEL32.DLL. Unless my understanding is wrong, the last three shouldn’t be a problem as they reside in the system32 directory (although I tried putting them in the ouptut directory as well just in case, but no dice). Therefore, I have also put SUITL.DLL and OPTIX_PRIME.1.DLL in the output directory, but I still get the error.
Dependency walker also says that there are several dlls that it cannot find:
In the digging that I have done, it looks like these DLLs are ones that were changed with Windows 8.1, and some of them have been removed completely, so i can’t just try to references to them to see if it fixes it. That being said, many people have reported that this is often a false negative and that many programs should work anyway, which lines up with what I see when I run the program from the .exe (or straight from visual studio), it runs without a problem. However, no matter what I do I always get the error telling me that there are DLLs missing.
Are these dependencies the problem? Are there other dependencies that I am missing? Is there a better way to call my optix program from c# that people have had success with in the past?