Using Irrlicht directly in C# without the .NET wrapper...

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
Kale Kold
Posts: 5
Joined: Sun Jun 10, 2007 5:11 pm
Location: Lincoln, UK
Contact:

Using Irrlicht directly in C# without the .NET wrapper...

Post by Kale Kold »

Hi, i'm writing a small program using C# that uses the Irrlicht.dll directly. It's not too hard to implement using the Interop classes in C# but i have run into a puzzling error. Basically i am importing the native DLL using an import command like this:

Code: Select all

[DllImport("Irrlicht.dll", EntryPoint = "createDeviceEx")]
static extern IntPtr Irrlicht_CreateDevice(ScreenCreationParameters Parameters);
and coded a nice little wrapper to handle calling this function. The problem is when i run my program it fails with this exception:
System.DllNotFoundException was unhandled
Message="Unable to load DLL 'Irrlicht.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
Basically it's saying that the 'Irrlicht.dll' can not be found. This is strange as the DLL is in the folder with the compiled assembly from my .NET project. Has anyone ever run across this before when using Irrlicht native with C#?

Thanks.
--Kale

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away".
-- Antoine de Saint-Exupéry (Champion against bloat?)
JRowe47
Posts: 55
Joined: Sat Jun 30, 2007 9:09 am

Post by JRowe47 »

You probably have to specify the path, as is the case with most external resource usage.
Kale Kold
Posts: 5
Joined: Sun Jun 10, 2007 5:11 pm
Location: Lincoln, UK
Contact:

Post by Kale Kold »

JRowe47 wrote:You probably have to specify the path, as is the case with most external resource usage.
That actually seems to be the problem. Thanks. Any ideas how i can specify a relative path (in C#) to use for the DLL import attribute. Because the attribute requires a constant parameter.
--Kale

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away".
-- Antoine de Saint-Exupéry (Champion against bloat?)
Post Reply