Page 1 of 1

Issue when trying to use irrlicht in a .net managed form.

Posted: Fri Jul 06, 2007 5:35 pm
by Murdock_SE
Greetings Irrlicht gurus:

I am getting a very odd error when trying to execute the following code. I get through compiling and linking this just fine in Visual C++ 2005 Express. Everything works fine right up to trying to execute the first line of Irrlicht.NET based code.

I keep getting an error of "An unhandled exception of type 'System.IO.FileNotFoundException' occurred in System.Windows.Forms.dll

Additional information: The specified module could not be found. (Exception from HRESULT: 0x8007007E)"


The code is below, this is within a windows button click event handler, and if I comment it out I do not get any errors. Also, I can do things like this->irrPanel->Focused = true;
this->Close();
etcetera. so the windows form itself is working just fine. What kills me is this compiles fine. I can see all of the relative object types, blah blah so I'm pretty darn sure I have all of my project directories set properly.

Any thoughts? This is driving me nuts, as it took a while for me to take the forum example vb .net code to parse it over to vc++ managed.


Irrlicht::Core::Dimension2D^ dim = gcnew Irrlicht::Core::Dimension2D(0,0);

IrrlichtDevice^ device = gcnew IrrlichtDevice(Irrlicht::Video::DriverType::OPENGL,
*dim , 16, false, false, false, false, this->irrPanel->Handle);

while (device->Run()){
if(this->irrPanel->Focused)
{
Irrlicht::Video::Color^ mycolor = gcnew Irrlicht::Video::Color();
mycolor->Set(0,000,100,100);
device->VideoDriver->BeginScene(true, true, *mycolor);
device->SceneManager->DrawAll();
device->VideoDriver->EndScene();
}
}

By and By..

Posted: Fri Jul 06, 2007 5:58 pm
by Murdock_SE
I can dupe this with the one single line of irrlicht related code:

Irrlicht::Core::Dimension2D^ dim = gcnew irrlicht::Core::Dimension2D(0,0);

I can also put this in the initializecomponent of a main form, so it has nothing to do with a windows event.

It has to be library related, but as I said before, the dll I added as a reference using browse. And I see the irrlicht.net.dll in my debug and release folders. So I know it's referenced properly. Also, I can use intellisense and see the object tree, and its methods, etcetera... Also, it compiles fine! So this is killin me.

Also, I do have "using Irrlicht;" in the top of the said file.

Nevermind... you have to 'also' copy over irrlicht.dll

Posted: Fri Jul 06, 2007 6:29 pm
by Murdock_SE
I've found the answer myself:

Anyone trying to do a .net managed code windows form to embed an irrlicht scene, make sure to ALSO COPY OVER irrlicht.dll into your projects /bin/ folder. By default, when you add a reference to irrlicht.net.dll, it only copies over that DLL. But it is a wrapper, and still needs irrlicht.dll present in the same folder.

Hopefully this helps other newbies like me that have existing .net managed c++ projects that wish to use embeded irrlicht 3d within; and you don't lose more hair like I did pulling it out trying to figure out why this was compiling but throwing filenotfound errors.

Regards. Moderators, feel free to move this to an applicable topic at your will.

Posted: Fri Apr 04, 2008 5:11 am
by simdev
Hi All,
I want to use irrlicht on a windows form appllication

Currently I am implementing my code on irrlicht CP with C# but the point is due to the wrapper code, its more than half slower for my current code comparing to C++.

Is it possible to use irrlicht (without any wrapper code) in managed C++ on a windows form application ? :roll:

Thanks