Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Advantages
FAQ
Screenshots
Shape factory
Shape gallery
Demonstrations
What's new
System requirements
Download Center
Public license
Documentation
Getting started
Forums
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
News
Home / Developer Corner / Forums / Draw and samples / Problems with C# sample

Problems with C# sample

Problems with C# sample
Michael Bate 2012/08/14 06:13
I rebuilt (after much difficulty) the C# sample (IE, OCC, shell) with VS2010. I had to change a few things: set up include and lib directories, change shell and occ to .NET 4 framework (because that was the framework that IE targeted after import to VS2010).

Since I am running 64-bit Windows 7, I had to change the IE target from "Any CPU" to x86 (since that is what shell and OCC targeted) otherwise I would get a cryptic MSoft error message saying a DLL had a bad format (attempt to call a 32-bit dll from 64-bit executable).

Now the program comes up but when I click File/New I get an error that it cannot find shell.dll or one of its dependencies. Shell.dll is in fact in the same directory as IE.exe and OCC.dll. So presumably it is complaining about one if its dependencies.

Am I missing something obvious? I don't see how to figure out what shell.dll dependencies are.
Pawel 2012/08/15 17:11
Hi Michael,

on Windows 7 you can use sxstrace.exe to find what (assembly) the program exactly complains about.

Have a look here: http://www.codeproject.com/Articles/43681/Side-by-Side-Configuration-Incorrect

Pawel
Michael Bate 2012/08/19 01:21
Pawel,

Thank you, but I tried what they suggest and sxstrace produced a log that was essentially empty: the parsed log had only three characters. I tried looking at the original log with a hex viewer and could see that it mainly contained kilobytes of "FF" characters.

I used ildasm to get a dump of the DLLs that it needed and found many (such as TKXSBase.dll) from the OpenCascade DLL directory (c:\opencascade6.5.3\ros\win32\vc9\bin). I tried adding the OpenCascade directory of DLLs at the front of my PATH, then invoked the program (IE.EXE) from the command line and got the same error. I even tried compiling IE.EXE and the two DLLs that are part of the solution (shell.dll and occ.dll) into the OpenCascade DLL directory and invoked it from there. This time IE.EXE did not even display its window and Windows reported that it had "stopped working."

Has anyone succeeded in getting the C# sample to work with VS 2010?
carlos 2012/08/19 11:19
Hi,

IE.exe must find all the proper dependencies to work and this is most likely the source of this error.

A good practice is the last test you have done putting ie.exe, shell.dll and occ.dll in the binary folder as you assure that all the dlls are in the same path.

Some points I would check:

Environtment variables ($Casroot) specially of the installation. You can use setenvirontmentvariable
You are saying that the dll's directory is \win32\vc9\bin but you use VS2010 so the directory should be VC10. If you are using precompiled dlls check this point.
IE.exe depends on Shell.dll and this on OCC.dll, that calls to the OCCT TK's libraries. But please consider that these TK's libraries also depends on some third party dlls, depending on your configuration (for example freeimage.dll). Check that you also have these dlls on the same directory.
I use Dependency walker to see the depencencies on a dll. I think that it is also provided with VS 2010 and if not is free. If you open OCC.dll you will see if someone is missing.
Another point to check is to be sure that all the dll's and the executable are Win32



Regards,


Michael Bate 2012/08/28 19:16
I solved my problem. I overlooked the need to set all the environment variables. Stupid mistake. The overview documentation describes these environment variables in gory detail, so I should have known.

I have some other questions (about C# wrappers), but I will start a new thread.     
 
 
Latest news
  • New features to enhance the development process
  • Open CASCADE Technology 6.7.1 is available for download!
  • Open CASCADE Technology 6.7.0 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map