
Fri, 07/29/2016 - 06:16
My application is not finding the OpenCascade DLLs , even though they are in the path.
I have built my own simple application OCSimple.exe, that uses OpenCascade, version 7.0.0.
It's going pretty well. I'm on Windows 10, developing using Visual Studio 2015.
I have to work in 32bit, as a customer requirement. I've successfully built 32 bit versions of the OpenCascade DLLs.
My application calls the DLLs, all is well - EXCEPT for one thing. It only works if the OpenCascade DLLs (TKernel.dll , etc) are in the SAME directory as my application OCSimple.exe.
I want to be able to have the OpenCascade DLLs in a different directory from the EXE, and put this directory in the path.
I want to distribute just the necessary OpenCascade DLLs , shaders and any other resources necessary with my application and AVOID having the USERS do a full install of OpenCascade.
I am setting the path and environment variables for OpenCascade in a batch file which then calls my OCSimple.exe, in the same way the samples do it.
I believe I am setting the path correctly, as I CAN put the third party DLLS (FreeImage.dll etc) in their own directory and they are found.
Is there some environment variable I need to set to point to the OpenCascade DLLs?
For instance, I am setting the location of the shaders, with:
set "CSF_ShadersDirectory=C:\Test\OCSimple_and_Delphi\Shaders"
I have tried setting CASROOT to the location of the OpenCascade DLLS:
set "CASROOT=C:\Test\OCSimple_and_Delphi\OpenCascade DLLs"
But this does not help.
To summarise the program setup is:
C:\Test\OCSimple_and_Delphi\
Contains the exe OCSimple.exe
Works if OpenCascade DLLs are here
Contains batch file run_OCSimple.bat , to set up environment variables and path, and call OCSimple.exe See below for its contents.
C:\Test\OCSimple_and_Delphi\Shaders
Contains the simple shaders used
C:\Test\OCSimple_and_Delphi\Third Party DLLs
Contains the third party DLLs , e.g FreeImage.dll. These are found!
C:\Test\OCSimple_and_Delphi\OpenCascade DLLs
Contains the OpenCascade DLLs, (TKernel.dll , etc). These are not found.
The contents of run_OCSimple.bat
Setlocal EnableDelayedExpansion
set "CASROOT=C:\Test\OCSimple_and_Delphi\OpenCascade DLLs"
set "CSF_ShadersDirectory=C:\Test\OCSimple_and_Delphi\Shaders"
SET PATH=%PATH%;C:\Test\OCSimple_and_Delphi\OpenCascade DLLs
SET PATH=%PATH%;C:\Test\OCSimple_and_Delphi\Third Party DLLs
call OCSimple.exe
This site: http://opencascade.blogspot.co.nz/2009/03/distributing-your-software.html mentions setting CSF_GraphicShr to point to TKOpenGl.dll , but I believe this is for an older version of OpenCascade, I don't see any reference to it in version 7.0.0.
Any help appreciated,
Thanks
Jim
Tue, 08/02/2016 - 02:17
OK,I have a solution, but it does seem to be different from what the Opencascade documentation suggests.
It works if I set the the path to the Opencascade DLLs with the WinAPI call
SetDllDirectory(), https://msdn.microsoft.com/en-us/library/ms686203%28v=vs.85%29.aspx?f=25... .
E.g SetDllDirectory("C:\\MyProject\\OpenCascadeDLLS")
But as I said, it doesn't work if I add "C:\\MyProject\\OpenCascadeDLLS" to the PATH environment variable, as it says I should here:
https://dev.opencascade.org/doc/overview/html/index.html#OCCT_OVW_SECTIO...
Anyone have any idea why this is?
Thanks
Jim
Tue, 08/16/2016 - 03:28
Solved!
There was an older version of the OpenCascade DLLS elsewhere on my PC, used/installed by another app.
These were in the system DLL directory , so were getting picked up before the ones in the path.
Hence the need to use SetDllDirectory() to specify the location of the ones I need to use.
Tue, 03/25/2025 - 05:21
Hey Jim!
Thanks a lot for didn't get help but still posting solution here.
I meet the same problem on my project, and your experience do help me a lot.