I’ve found a bug in C# wrapper. It’s working properly on 32 bit .Net Framework, but on 64 bit it crashes.

You need to fix wrapper to following code:

public struct TAG
public TAGTYPE type; /* [out] The type of this tag. /
public TAGDATATYPE datatype; /
[out] The type of data that this tag contains /
public string name; /
[out] The name of this tag i.e. "TITLE", "ARTIST" etc. /
public IntPtr data; /
[out] Pointer to the tag data – its format is determined by the datatype member /
public uint datalen; /
[out] Length of the data contained in this tag /
public bool updated; /
[out] True if this tag has been updated since last being accessed with Sound::getTag */

[DllImport (VERSION.dll)]
private static extern RESULT FMOD_Sound_GetTag(IntPtr sound, string name, int index, IntPtr tag);

public RESULT getTag(string name, int index, ref TAG tag)
IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(tag));
RESULT result=FMOD_Sound_GetTag(soundraw, name, index, ptr);
tag = (TAG)Marshal.PtrToStructure(ptr, typeof(TAG));
return result;

I don’t know why original code doesn’t work. Anyway, this helps :)

And another bug. All C# example projects are created using 32 bit fmodex.dll and platform target is set to Any CPU – this is bad, because on 64 bit OS it will use 64 bit Framwork and will try to load 32 bit dll. So, You need to change platform target to x86. I think, You should also add examples_csharp to 64 bit dev kit (with above fix ofcourse) and make DllImport of fmodex64.dll. Maybe, You should also make fmod.cs platform independent, which will allow You to leave platform target as Any CPU and fmod.cs will use fmodex or fmodex64 depeding on platform which it calls.


  • You must to post comments

Thanks Thom,

I’ll merge your fixes into our next release

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.