Cancel
Showing results for 
Search instead for 
Did you mean: 

"Failed to load image" error when open *.dll file

Experimenter
Experimenter

We have a tool programmed by C++ and works very well in NX9.

But after we upgrade our UG to NX10, when I try to open the *.dll file, I got "Failed to load image-see log file for details. File name: *.dll. Funtion name: ufuser." error. I attached a screen shot to show the message.

My operation was use "File/Execute/NX Open/*.dll".

Besides, the *.dll file has been signed use "SIGNDOTNET. EXE"

Have you ever see similar error? Do you know how to fix it?

Appreciat a lot for your help.

 

17 REPLIES

Re: "Failed to load image" error when open *.dll file

Genius
Genius

Hello Yanping!

 

Did you update the nxopen-references?

When creating an application (e.g. *.dll) you have to set the references

(NXOpen.dll, NXOpen.Utilities.dll, ...) in the project.

 

Since the NXOpen-Interface grew a lot from NX9 to NX10 the old

sources won't work.

 

You should try to set the new references and recreate the *.dll file

(Don't worry, you won't have to change your code since all 'old'

method signatures stayed the same!).

 

Hope that helps!

 

Flo

Re: "Failed to load image" error when open *.dll file

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

You'll probably have to re-compile & re-link the DLL for NX10.

I believe it is recommended you start with a new (NX10) C++ NX template, then re-add your code.

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled


Re: "Failed to load image" error when open *.dll file

Siemens Phenom Siemens Phenom
Siemens Phenom

C++ applications need to be recompiled and relinked against the libraries delivered with every release using the specified compiler version for that release.

 

The NXOpen*.dll's mentioned as references in the first reply in this thread are only used by .Net (VB and C#). They are not used by C++, Java or Python.

 

If you are signing a C++ application, you should be using %UGII_BASE_DIR%\UGOPEN\signcpp.exe. (%UGII_BASE_DIR%\UGII\SignDotNet.exe is only for .Net applications, as it's name implies).

 

 

 

 

 

Re: "Failed to load image" error when open *.dll file

Genius
Genius

Hello JimB!

 

You are absolutely right, I somehow thought Yanping was using C#!

Thank you for the correction!

 

Bye,

 

Flo

Re: "Failed to load image" error when open *.dll file

Experimenter
Experimenter

Hi FlolScreen

 

The issue is resolved per your suggestions.

 

Thanks

 

Re: "Failed to load image" error when open *.dll file

Experimenter
Experimenter

Thanks, JimB.

The issue is resolved.

Re: "Failed to load image" error when open *.dll file

Experimenter
Experimenter

Please explain every step to correct the error

Re: "Failed to load image" error when open *.dll file

Experimenter
Experimenter

Hi FlolScreen,

                      Please explain the things that you said to yanping in a detailed manner. I am facing the same issue and couldn't resolve it

 

Re: "Failed to load image" error when open *.dll file

Siemens Phenom Siemens Phenom
Siemens Phenom

The following text is from the "Getting Started with SNAP" document, but it applies equally to VB or C# programs that call NX/Open functions. I suspect that it applies to C++ programs, too, but that's just a guess. The SNAP document is here. See page 114.

 

Failed to Load Image

The “Failed to Load Image” error can occur for several reasons. One common reason is a mismatch between the type of your NX installation and the type of application you created. Specifically, you will get this error if you have a 64 bit version of NX but you try to run a 32 bit application.

 

If you’re watching carefully, you will see an indication of this problem when you build your application. You will receive a warning like the one shown below:

<picture>

The message indicates that the dll targets a 64 bit processor (since it is part of 64bit NX), but your application (ConsoleApp1) targets a 32 bit processor. But this is only a warning, so the build will succeed. However, when you try to run your application, you will get this error

<picture>

If you look in the NX syslog, will find something like this:

The reason ...\ConsoleApp1.exe failed to load was:
Cannot classify image ...\ConsoleApp1.exe

Again, this indicates that 64 bit NX was unable to load and run your application because it was built for a 32 bit architecture. With the full version of Visual Studio, you can avoid this problem by specifying what type of application you want to build. But in Visual Studio Express, there is less flexibility in this area, so you have to be careful to base your projects on the right type of template. With the Visual Studio “Console Application” template, the default target is a 32 bit architecture, so you may run into problems if you are using a 64 bit version of NX. If you always use the project templates we provide, then things should go smoothly.

 

A slightly better explanation is included in the "Getting Started with NX/Open" guide, which you can find here. Look at page 134 of the document.

 

山田
yamada