patricksebastien / libpd4unity

libpd for unity 3d
101 stars 20 forks source link

iOS: Unable to load DLL 'libpdcsharp' #20

Open kevvy-log-ins opened 7 years ago

kevvy-log-ins commented 7 years ago

I'm working with Unity 5.5.1f1 on macOS 10.12.3. I can compile 01_LibPd_Basic as a Mac Standalone, and it works as expected (after I make changes suggested in previous bug reports).

When switching the platform to iOS, however, while the project compiles, it generates no sound, and Xcode issues the following errors to its console:

Coincidentally, no version of the libpdcsharp file exists within the Xcode project, as far as I can tell.

ablanton commented 7 years ago

hi all was there ever a fix or workaround to this issue?

thefuntastic commented 7 years ago

I once managed to get a proof of concept working on iOS, but involves getting stuck into xcode to build it as a native plugin. Not for the faint of heart, and it suffered from performance issues. And that was before unity added IL2CPP so I'm not sure how that would work these days.

If you need a working version, I can recommend https://enzienaudio.com/ It's licensed, but the terms are fairly reasonable. It's a platform that cross compiles pd into native unity plugins. Would be less effort to port your code across to heavy than to try add iOS plugin support.

gershhub commented 7 years ago

@thefuntastic can you comment on the first steps you took to build the iOS dll? Building vanilla libpd for iOS seems straightforward-- what was required to get the C# bindings to work?

Edit -- nvm, I found @n1zzo's comments and am trying it out. Thanks for all the amazing work!

gershhub commented 7 years ago

For anyone happening upon this, I'd suggest replacing the line const string DllName = "libpdcsharp"; in LibPDNativeMethods.cs with the following preprocessor directive:

#if UNITY_IPHONE
const string DllName = "__Internal";
#else
const string DllName = "libpdcsharp";
#endif