object strange behaviour
Hi,
I've tried to look if this problem has been discussed earlier but couldn't find it.
I have a problem with an external that I succesfully build and put into the Cycling '74/externals/ folder. Still when I start a patch with the external object in it , it's this grey box indicating that it isn't a valid object. But if I make a new object with the same name it works perfectly.
It is a mystery to me why this is happening, can someone shed some light?
thanks in advance,
Tim
On Fri, Jul 4, 2008 at 4:44 PM, Tim Groeneboom
wrote:
>
> I have a problem with an external that I succesfully build and put into the
> Cycling '74/externals/ folder. Still when I start a patch with the external
> object in it , it's this grey box indicating that it isn't a valid object.
> But if I make a new object with the same name it works perfectly.
>
>
That sounds strange. What do you mean exactly with "it works perfectly"?
Have you successfully used its io/messages? The reason why I ask is that an
unknown object "looks" like a bogus object only when you load it from a
patch. Typing in any invalid name into an object box still looks like an
object. Both will generate an error in the max window: "foo: no such
object".
There can be several reasons why your object fails to instantiate, and its
hard to say without additional info or code. You could run the debugger in
combination with Max Runtime to see what goes wrong. Set a breakpoint in
your objects new function. If it never hits this point, you might have
forgotten to export the main function.
Thijs
> There can be several reasons why your object fails to instantiate, and its
> hard to say without additional info or code. You could run the debugger in
> combination with Max Runtime to see what goes wrong. Set a breakpoint in
> your objects new function. If it never hits this point, you might have
> forgotten to export the main function.
>
> Thijs
>
The object instantiates when creating it manually with the object box (and works fine, all the functions work, doesn't crash , works like it's supposed to), while fails to instantiate while loading a saved max patch (with the object in it). Because of this i'm unable to debug my external.
For what it's worth i'll post my new and main function.
void main()
{
setup((t_messlist **)&burges_class, (method)burges_new,0L, (short)sizeof(t_burges), 0L, A_GIMME, 0);
addbang((method)burges_bang);
addmess((method)burges_secondList,"secondList",A_GIMME,0);
addmess((method)burges_firstList,"firstList",A_GIMME,0);
addmess((method)burges_setDimensions , "setNumberOfDimensions" , A_LONG , 0);
addmess((method)burges_reset , "reset" , A_NOTHING , 0);
addmess((method)burges_save , "save" , A_SYM , 0);
addmess((method)burges_open , "read" , A_SYM , 0);
}
void *burges_new(t_symbol *s)
{
t_burges *x;
x = (t_burges *)newobject(burges_class);
x->m_maxRows = 1000;
x->m_maxDim = 300;
// create two-dimensional arrays of doubles
x->m_xx = dmatrix(1,x->m_maxRows,1,x->m_maxDim);
x->m_yy = dmatrix(1,x->m_maxRows,1,x->m_maxDim);
x->m_firstListRows = 0;
x->m_secondListRows = 0;
x->m_numberOfDimensions = 0;
x->m_outtype = A_GIMME;
x->m_out = listout(x);
SETLONG(x->m_args+1,0L);
SETLONG(x->m_args,0L);
return x;
}
Thanks!
On Fri, Jul 4, 2008 at 6:09 PM, Tim Groeneboom
wrote:
>
> The object instantiates when creating it manually with the object box (and
> works fine, all the functions work, doesn't crash , works like it's supposed
> to), while fails to instantiate while loading a saved max patch (with the
> object in it). Because of this i'm unable to debug my external.
An object could fail to instantiate due to something going wrong in your
constructor/new function. In any case your main, and therefore the new
function, should be called by Max afaik. With the exception of a missing dll
/ framework maybe, I'm not sure if it detects such issues before calling
main().
I have no idea what's wrong, sorry. It makes no sense to me. Also I can't
find anything wrong with your code example.
What are the error messages you are getting in the max window? What version
are you running?
Thijs
The code is pretty plain-vanilla and looks fine. So the next question is how you're building.
Presumably you're working with Max 4.6 or 5 and have set up an XCode project according to the online tutorial?
I seem to recall that were some teething problems with Mach-O based externals on Max 4.5, or possibly even early 4.6, with symptoms resembling yours. To figure out where the problem lies, the first thing to know is your Max version and what your development environment is, w/version info. And where are you building your object to relative to the Max search path.
I'm using Max 4.6.3 and I develop with XCode 3 , my products are build directly into the Max externals folder. I also forgot to mention that it did work fine for a while (debugging my object, saving and loading it worked fine), and suddenly this happened, and I have no idea what I might have done that caused it. The project is a modification of the maximum example of the max sdk.
Anyway, thanks for all the help :)
It sounds like everything should be just fine. All I can do is guess, but here's one thing to check: You don't, by any chance, have a file in the same folder as your test patcher with the same name as the external you're building? It doesn't matter if the suffix is different, basically anything that Max might recognize as a possible file resolving your external's name will screw things up royally.