FileLoadException - what's wrong with my assembly?

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? :)
 
A

Arnaud Debaene

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
 
G

Guest

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top