i'm trying to build up an external which should communicate straight to another object via a sw system, in a MVC architecture. The problem is that I cannot see how to implement a send/receive method inside my exetrnal.
The clean way to do this is having your object A directly calling methods of B. This is straightforward (use object_method in one of its flavors) as long as A knows the memory address of B - which can be accomplished in a variety of ways (according to how you want your objects to be aware of each other), including binding B to a symbol:
gensym("my_B_object")->s_thing = x;
or iterating the patcher...
On a side note, but this is strictly personal, I don't like wireless communication in Max. I am suspicious about the pattr system, value, pv and even send/receive, I use them as little as I can... I think they really work against the Max paradigm... but, then again, that's just me... ;)
But still I can't outline a practical way to implement this method.
Actually my external is a float object (ui object). What i'm attempting to do, is receiving the values sent out from my external (while i'm scrolling it), in a specific "receive" object - e.g. [r receive_my_external].
I see that i'm supposed to pass "the object that will receive the message" as first parameter of object_method. Am i supposed to point to [r receive_my_external] from here?
to accomplish a mechanism like send/receive, you need to use the object notification system of Max. Unfortunately, the usage of this is quite splitted up within the documentation (at least, this was the case in the Max 5 SDK -- I don't know if the situation changed with Max 6, as I still did not make that step). I implemented a generic "stream" object (an object capable of streaming bytes between externals that use my interface) within The sadam Library a few years ago, using the globalsymbol/object_notify/object_method stuff. On the one hand, you may wish to experiment with using that one; although my project is closed-source, the header file describing the interface of my streaming object is public, and the documentation contains a chapter explaining how to use it. On the other hand, you may wish to read the forum thread where I summarized the key points of attaching to/detaching from named objects (along with the links mentioned by Nicolas): http://cycling74.com/forums/topic/globalsymboling-issues (and, as a small addendum: http://cycling74.com/forums/topic/object_notify-and-thread-safety ).
BTW, as I have heard, the situation changed in Max 6, now it is much easier to create a proper send/receive scenario. However, if you want to stay Max5-compatible, you'll need the solution described in the above links.