FileLoadException
-
Hi, I got some unexpected trouble when I tried to write a managed wrapper around a native dll. This is what I did: 1) wrote a wrapper in C++/CLI and compiled it into dll file (with /clr switch) 2) created project in C# and added reference to a wrapper 3) in C# I created instances of some classes from my wrapper, everything compiled fine 4) when I ran C# project I got FileLoadException saying: A procedure imported by [assembly name] could not be loaded. Any ideas what might cause FileLoadException? This is a simplified C++/CLI code which I used for testing and got the same problem as described above:
// test.h #pragma once #include #pragma comment(lib, "Irrlicht.lib") using namespace System; using namespace irr; // from irrlicht.h namespace test { public ref class Class1 { public: void Foo(void) { System::Console::WriteLine("blah blah blah"); } void Bar() { **IrrlichtDevice * dev = createDevice(); // calling native function** } }; }
-- moose -
Hi, I got some unexpected trouble when I tried to write a managed wrapper around a native dll. This is what I did: 1) wrote a wrapper in C++/CLI and compiled it into dll file (with /clr switch) 2) created project in C# and added reference to a wrapper 3) in C# I created instances of some classes from my wrapper, everything compiled fine 4) when I ran C# project I got FileLoadException saying: A procedure imported by [assembly name] could not be loaded. Any ideas what might cause FileLoadException? This is a simplified C++/CLI code which I used for testing and got the same problem as described above:
// test.h #pragma once #include #pragma comment(lib, "Irrlicht.lib") using namespace System; using namespace irr; // from irrlicht.h namespace test { public ref class Class1 { public: void Foo(void) { System::Console::WriteLine("blah blah blah"); } void Bar() { **IrrlichtDevice * dev = createDevice(); // calling native function** } }; }
-- mooseShow us the code for the wrapper. That's probably where your problem is.