melanchall / drywetmidi

.NET library to read, write, process MIDI files and to work with MIDI devices
https://melanchall.github.io/drywetmidi
MIT License
523 stars 73 forks source link

add il2cpp mode #282

Open fingerx opened 5 months ago

fingerx commented 5 months ago

This is an excellent library, but I encountered problems when compiling with the IL2CPP mode. I hope support for Unity IL2CPP mode can be added. Thank you very much!

error msg: Unity: NotSupportedException: IL2CPP does not support marshaling delegates that point to instance methods to native code. The method we're attempting to marshal is: Melanchall.DryWetMidi.Multimedia.InputDevice::OnMessage_Win Melanchall.DryWetMidi.Multimedia.InputDeviceApi64.Api_OpenDevice_Win (System.IntPtr info, System.IntPtr sessionHandle, Melanchall.DryWetMidi.Multimedia.InputDeviceApi+Callback_Win callback, System.Int32 sysExBufferSize, System.IntPtr& handle) (at <00000000000000000000000000000000>:0) Melanchall.DryWetMidi.Multimedia.InputDevice.EnsureHandleIsCreated () (at <00000000000000000000000000000000>:0) Melanchall.DryWetMidi.Multimedia.InputDevice.StartEventsListening () (at <00000000000000000000000000000000>:0)

melanchall commented 5 months ago

Hi,

I know about this problem, but I can't turn those methods within the library into static ones unfortunately. It will just ruine the logic. I'm going to keep the issue open but right now I can't provide a solution.

Thanks, Max

melanchall commented 4 months ago

@fingerx Hi,

Can you please say, do you build your game with IL2CPP on Windows?

fingerx commented 4 months ago

@melanchall yes,but not game. it is window application for x64

melanchall commented 4 months ago

@fingerx Can you please say how to create such an application? Or maybe you can provide me a sample Visual Studio solution so I can run it on my side to debug?

melanchall commented 2 months ago

@fingerx Can you please provide info?