using dll's on mac os x (remap gdiplus.dll/win dll dependencies)

Hi,

I’m working on a project where i need to use System.Drawing to be able to use the printer.

Now, there’s a problem on mac os x as System.Drawing seems to be using the lib gdiplus.dll.
Not that big of a problem as mono has their own implementation libgdiplus.dylib for mac.

But how do I make Unity look for libgdiplus.dylib instead of gdiplus.dll?
Both System.Drawing.dll and libgdiplus.dylib is in my Assets/Plugins (the Plugins folder seems to be special somehow)
I’ve tried adding an entry to the mono-config, both in Unity and the built app.
I’ve tried to rename the .dylib to .dylib.bundle and event to gdiplus.dll.
I’ve added a gdiplus.config that has the same entry as the dllmap-config in mono.

Not sure what else to try?

It works perfect on windows, but on mac I get a DllNotFoundException.

Thanks!

Did you get this to work on osx / mobile platforms?

Would be glad if you’d share the solution! :slight_smile:

Any news on this ?
I’m stuck on my project

This is an old thread from people with only 1 post. I doubt they’re around anymore.

Also, this is just not doable. System.Drawing is a Windows specific dll.

The best you could do is write your own version of System.Drawing that has types named the same as all of them, but ties into libgdiplus.dylib. Basically emulating/mimicking the interface of System.Drawing.

This is not trivial.

And honestly, I just wouldn’t do it.

Technically speaking people have already done this… like here:
https://github.com/CoreCompat/System.Drawing

I can not contest to its compatibility with Unity though. And again, I just wouldn’t do it.