FileLoadException - what's wrong with my assembly?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

In C++/CLI (with VS2005 beta2) I wrote a little wrapper around a native dll
(to which I headers and .lib). Wrapper was a ref class with some methods
calling native functions from native dll. It all compiled and linked fine
giving me an assembly dll. Sweet.

Then I created C# project and added a reference to my wrapper. In C# I
created intance of a wrapper class and called some of its methods. Again it
compiled with no problem. Veery sweet I thought... and I was wrong.

As soon I as ran C# project I got FileLoadException thrown. The message was:
A procedure imported by [my wrapper assembly name] could not be loaded.

So here I am. Standing suprised, not knowing what's wrong with my assembly.
Any ideas? :)
 
moose said:
Hi,

In C++/CLI (with VS2005 beta2) I wrote a little wrapper around a
native dll (to which I headers and .lib). Wrapper was a ref class
with some methods calling native functions from native dll. It all
compiled and linked fine giving me an assembly dll. Sweet.

Then I created C# project and added a reference to my wrapper. In C# I
created intance of a wrapper class and called some of its methods.
Again it compiled with no problem. Veery sweet I thought... and I was
wrong.

As soon I as ran C# project I got FileLoadException thrown. The
message was: A procedure imported by [my wrapper assembly name] could
not be loaded.

So here I am. Standing suprised, not knowing what's wrong with my
assembly. Any ideas? :)

Use dependency walker on your wrapper assembly to check if all the necessary
native DLLs are available.

Arnaud
MVP - VC
 
Arnaud Debaene said:
Use dependency walker on your wrapper assembly to check if all the necessary
native DLLs are available.

I used depenedancy walker and got the problem solved :) Thx man.
In fact the problem was not missing native DLL but the old version of DLL (I
used the latest .lib to compile wrapper and then tried to bind to old DLL).
 
Back
Top