Using FMOD for C#?

user488792 picture user488792 · May 16, 2011 · Viewed 9.5k times · Source

I'm working with FMOD in C#. I've tried importing the fmodex.dll file by selecting Project->Add Reference and browsing for the fmodex.dll, but I am getting an error:

A reference to ... could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component

It is accessible, but I still get the error. I read the guide and it says to use the fmodex_vc.lib when linking to the fmodex.dll file. So I try, but I can't seem to find on how to link to .lib files in Visual Studio; searching Google always leads me to linking to .dll files.

Answer

jeremy-george picture jeremy-george · May 16, 2011

Fmod is written in unmanaged C++ so you cannot reference it directly from a .Net application. There is a c# wrapper to the fmodex.dll in the fmod package under a directory called "fmod_wrapper" if I am not mistaken that you can add to your project and which will take care of making the P/Invoking for you.