I have a project using a managed plugin which wrap a native one. The wrapper is using the UnmanagedType.CustomMarshaler attribute with MarshalTypeRef to marshal some custom types using a custom marshaler. On Windows, OS X and Android, it works as expected. On iOS (with IL2CPP), a NotSupportedException is thrown, telling me that the custom types cannot be marshalled (the custom marshaler is never created). My current work-around is to manually call the custom marshaler on iOS.
Is that a known limitation of the current version of IL2CPP ?
Or is it a bug because it should be supported ? (I’ll report a bug if it is)
Custom marshalers are not currently supported by IL2CPP. I believe it is possible to do so, but we’ve not seen a need for it yet, so we’ve not implemented this.
Do you use this custom marshaling on iOS with Mono? I’m uncertain now about whether or not we support it there. If so, we should probably support it on IL2CPP.
Thanks for trying this with the Mono scripting backend. Could you submit a bug report via Help > Report a Bug in the editor? That way we can feedback to you when this is corrected, and you can remove your work around.
Can we use it yet?
Wanting to load byte[ ] data to classes with nested structures and zlib compressed data auto uncompressed/compressed…
For anyone else reading this:
I ended up just subclassing BinaryReader/BinaryWriter and adding methods to handle compressed data, decompress it to a byte array open a memory stream feed it to a reader and return it. Kind of irksome but useable and still fast.