Juce static library includes a link to _NSApp?

I'm trying to build a Cython interface to a Juce program, which results in a static library to be opened by Python.

Unfortunately, it seems as if static libraries created by Juce contain an unsatisfied reference to _NSApp - which, near as I can tell is the "main function" on OS/X.

Well, when you're operating inside Python, there is, most unfortunately no NSApp.  And NSApp references seem to be liberally scattered around the Juce library code...

Is there any way around this?  

I'd really, really like to be able to use Juce's code from Python... right now, I'm running a completely separate client application, and using a socket connection and serialization to communicate back and forth but it's slow, and it's fragile and hard to maintain across platforms...

...which means I'm willing to do quite a lot of work to get around this issue, if it's at all possible.

Hmm.. Using NSApp is pretty much unavoidable if you're using the juce_event/juce_gui modules, because it manages the message loop. But do you mean your project's a command-line python app which doesn't use those modules?

It's a command line app - BUT it needs graphics for the lighting visualization part, which is the main part that really needs C++ acceleration.

As I said, I'm pretty desperate to get away from the "client in a separate C++ program" for multiple reasons.  I'd be willing to put quite a lot of work into getting this to function - or even to pay someone else who had an idea of what to do.

Tk does actually do this perfectly well - indeed, Python has tkinter which wraps it.  Unfortunately, this was far, far too slow when I tried it... the separate Juce client does work but getting it to come up and down reliably and the bottleneck that's the socket connection are giving me constant annoyance.



I'm going to be doing this also for Linux (Raspbian) and Windows, and I imagine there might be comparable hitches so if you had any ideas about them, lay them on me.

This won't really work for me unless I can get it to work on Linux and preferably also on Windows (though, well, I could in a terrible pinch bypass it).

Can you just link the Cocoa framework into the app somehow?

It's not an app, though - it's a .so.  Python is the app which loads it at runtime.

Some other material I read led me to believe that linking in Cocoa might not work, but, well, no harm in trying!


Thing is: NSApp is needed for really fundamental stuff involving messages, so I don't really know how you could avoid it..

Whoa, that worked well!  I should never believe anyone except you, Jules.  :-D

It linked, loaded into Python, and printed JUCE v2.1.7.

Of course, now I need to actually put something in the code that does something and see how it goes. I'm going to start with audio, and then move to (crossed fingers) graphics.  Stay tuned!

I'm interested in following this route as well, for linux, mac and windows.  How is it working out for you?

Any chance you'd put the cython code up on github?  I don't mind writing all of it, but I'm sure we won't be the last people who want this to work.