Writing Objective-C Externals for Max
I thought you might be interested to know that I’ve finally done
something of a release of the ObjectiveMax project that was alluded to
here back in October.
I’ve posted a blog entry here:
The direct link to the project site is here:
If you want to contribute please let me know. It would be great to
see this effort further developed by the community.
Tap.Tools / Teabox / Hipno / Hemisphere
Am I missing something? I can’t find a directory for
MaxObject.framework anywhere. Can’t figure out how to build it
either. Any help would be great. Sorry if I’m missing anything
obvious. I’m very excited about this whole project.
On May 24, 2008, at 9:15 AM, Timothy Place wrote:
> Hi all,
> I thought you might be interested to know that I’ve finally done
> something of a release of the ObjectiveMax project that was alluded
> to here back in October.
> I’ve posted a blog entry here:
> The direct link to the project site is here:
> If you want to contribute please let me know. It would be great to
> see this effort further developed by the community.
> Tap.Tools / Teabox / Hipno / Hemisphere
To build it, you should be able to do it by opening the Xcode project
in in the MaxObject folder and then building it. There is also a new
(as in it has only existed for a couple of days) list set up
specifically for ObjectiveMax below if you have other questions.
On 2008 May 28, at 8:25 AM, Keith Manlove wrote:
> Am I missing something? I can’t find a directory for
> MaxObject.framework anywhere. Can’t figure out how to build it
> either. Any help would be great. Sorry if I’m missing anything
> obvious. I’m very excited about this whole project.
> On May 24, 2008, at 9:15 AM, Timothy Place wrote:
>> Hi all,
>> I thought you might be interested to know that I’ve finally done
>> something of a release of the ObjectiveMax project that was alluded
>> to here back in October.
>> I’ve posted a blog entry here:
>> The direct link to the project site is here:
>> If you want to contribute please let me know. It would be great to
>> see this effort further developed by the community.
I’m tryin’ to follow the instructions to build a simple object (dr.op) in a very slavish way, but I receive a compiling error:
Command /Developer/usr/bin/gcc-4.2 failed with exit code 1
Building Maxobject.framework seemed ok, even tough MaxObject.a is in red and compiler shows a lot of advertising…
I’m really a newbie in C and similars, so any suggestion is very welcomed!
Is it possible to compile jitter objects with this method?
@efe: I have not done any work to wrap/support Jitter methods with ObjectiveMax. If anyone would like to contribute this to the project, just let me know!
@matpe: When you build MaxObject, you can build it as either a framework or as a static library (the .a file). So it’s fine that the .a file is red, because the example externs in ObjectiveMax use the .framework version. In Xcode you can switch between these in the pop-up menu in the upper-left of the main project window.
It turns out that there was some project maintenance that needed to be done. I’ve done it, and things should compile again. If you’ve checked-out using Git, then give it a pull and hopefully it will all work for you now.
For the gitophobes, you can now download @ http://github.com/tap/ObjectiveMax/downloads
Nice nice nice! time to clone the project!
it works like a charm! Thank you so much. A really exciting project.
I also compiled dr.op~. Everytime I close the window I receive a message in the max window as:
freeobject: random string (e.g. 1995c4a7): bad object.
Any tip about developing an audio object with ObjectiveMax?
Thank you again.
Thanks for the info. It’s been fixed. Details @ http://github.com/tap/ObjectiveMax/commit/025a94b6d67486cb99d238e1b46e0e4a6733779a
I downloaded again ObjectiveMax and recompiled but I receive the same error. Tried to correct only the MaxObject/maxobjectbridge.m, but no difference…
But I’m maybe misunderstanding something.
First, when you say you downloaded again, can you confirm that you downloaded 1.7.1. Second, you would have needed to compile the MaxObject framework — not just the object. Then, you might make sure that the framework was correctly copied to /Library/Frameworks. I have noticed in the past that sometimes Xcode will fail to replace a framework in /Library/Frameworks if it already exists.
I had to be more precise…
Yes, I followed all the steps:
- downloaded 1.7.1
- compiled MaxObject framework and copied to /Frameworks.
Closing window returns ‘bad object’ with dr.op~.
Can someone gave me a hint or point me to the right resources about how to create a new ObjectiveMax project in Xcode 3.2?
BTW, objective max seems really cool! I can get everything compiled without a problem.
I’ve been tinkering with ObjectiveMax for a little bit now, but I can’t seem to find any documentation. So I have 2 questions:
First, is there documentation anywhere?
Second, as I’ve been trying to do things that aren’t right, I end up completely crashing Max and it just quits. Whilst I understand I’ve done stuff wrong, is there a way I can just make the external complain quietly (e.g. like a js object would), rather than kill the whole Application? I don’t think I’d really feel happy using my own externals knowing that this is the result if something went wrong.
Documentation for now consists just of the couple of example projects. If you (or anyone) wants to contribute documentation it is very much needed. Welcome to open source :-).
As for problems occurring at runtime instead of at compile time, this is one of the dangers of dynamic binding. With Objective-C it is arguably more important to pay attention to any compiler warnings, because they may point to serious problems in the compiled binary. Beyond that, it is difficult to speculate without seeing the project/code.
If you are crashing with a crashlog, you can post it here. It most likely will point you to your problems. Also, you should run in the Xcode debugger to track this down(launch your patch in max runtime).
If it is simply quitting, it sounds like an uncaught exception, or has reached some part of a code path which calls exit(). If you are integrating other libraries or apple API features that throw exceptions, you will need to handle them.
Thanks very much for the pointers! I’ll keep experimenting and see how it goes :)
Is this project still active?
The GitHub pages now 404 and the version at Google Code is labeled v0.1.1 whereas the more recent discussion (a year ago now) talks about v1.7.1.
I’ve not had a need for using Objective C before, but now need to interface to Cocoa, so was hoping this might be an appropriate way.
Peter, you can just call into Cocoa via Objective-C in your Max externals C source anywhere, since Obj-C and C can be used interchangeably. The only gotcha is memory management, where you need to manage your own auto-release pools.
Syphon uses Objective C in the Jitter externals. Feel free to poke around the source if it is useful to you.
Edit: Here is a sample from the Syphon Client:
Note the source file is named a ‘.m’ so Xcode can auto-magically compile it as Obj-C. We use an Objective-C object in the jitter struct on line 55, and anywhere we need to call into Obj-C / Cocoa, we ensure we create an auto-release pool (and drain it) as needed. See line 268 for example. Hope that helps!
Thanks very much, Vade.
Actually got this working last Thrus/Fri by reading some other code kindly posted to the forum (merci à toi, vanille !)
The library I’m linking to is actually in Objective-C++, so I have three C dialects dancing around the project. It’s not hard once you get used to it, but it does take a little getting used to.
Now I just have to build a Windows version, which will be largely the same but without the Obj-C wrappers.
I’ve been wanting to try out ObjectiveMax for a while, but I’m getting bizarre errors while trying to build the MaxObject framework. For some reason, I get "Unknown type name" errors (for intmax_t, uintmax_t, etc.) and "Use of undeclared identifier errors" (for equally arbitrary type names) when I try to build. I can’t see any obvious reason for this, but I’m guessing maybe it has to do with changes in the way Xcode works in more recent versions. Do you have any tips about how I might get this compiling?
thanks in advance.
hmm… actually, I hadn’t read the thread carefully enough. I just tried putting an NSMutableDictionary in a "normal" max external, just by renaming the .c to a .m and using a local autoreleasepool, as Peter recommended, and it worked perfectly! How cool is that!
I really just wanted access to some of the data structures from Obj-C, so this is a great solution.
Thanks for the tip, Peter.
I’m not sure what header defines intmax_t and friends, but you’ll need to #include to fix that problem. On the otherhand, there are many ways to skin a cat. Glad you’ve found a way that works for you!