problem at object init
Apr 20, 2010 at 1:58pm
problem at object init
One of my externals (called “virtualfund”) exhibits a strange behaviour when I first load it:
- If I open a patch containing the object, I get a “virtualfund: No such object”. If, subsequently, I try to type it in the same patch, I get the same error. Then, if I type it in a new patch, it loads, and from now on I am able to load it in the first patch as well.
- If I type it in a new patch at first, it loads – and then I am able to correctly open a patch that contains it.
- If I load it manually, everything goes fine.
The external is in the same folder as all my other externals, which all load seamlessly.
Any ideas about that?
Apr 20, 2010 at 4:15pm
Hello andrea agostini,
it never happened to me … and i have no idea immediatly ; if it is not too secret to be shared maybe you should post the code or/and zip the external to have a look and make few test on my computer.
Apr 20, 2010 at 4:41pm
Make sure that the object call class_register at the end of main()… or send me the external ;-)
Apr 20, 2010 at 11:26pm
Thank you guys…
@ej: yes, the class_register call is there indeed… more coming soon! ;)
@pizza: the code is quite long and somewhat garbled – moreover, there’s a quite clever algorithm inside, which I borrowed from a lisp thing by a friend of mine, so I don’t feel like posting it on the forum.
c = class_new(“virtualfund”, (method)virtualfund_new, (method)virtualfund_free, (long)sizeof(t_virtualfund), 0L, 0);
class_addmethod(c, (method) virtualfund_int, “int”, A_LONG, 0);
post(“virtualfund object instantiated”);
but the thing is, if I try to debug it in Xcode it doesn’t even enter main()… and no, I have nothing else called “virtualfund” in my search path :(
Apr 20, 2010 at 11:56pm
I have an old testing patch that works perfectly when opened.
But if I create a new patch with only a [virtualfund] inside, I save it, close max, reopen max and load the patch, the object is gray and I have the error message.
(the declarations of the object in the two .maxpat files look pretty similar…)
Apr 21, 2010 at 12:53am
You have a missing argument in your
If that’s not the case… just send me the thing offline…
Apr 21, 2010 at 9:48am
No, it’s not its fault.
Actually, A_GIMME was there, but since the object accepts no arguments I tried to remove it to see if anything changed… which didn’t…
thank you anyway!
Apr 21, 2010 at 12:54pm
Is your Xcode project based off of one of the example Xcode projects in the SDK? Are you absolutely certain that you spelled “virtualfund” in the class definition spelled exactly the same way as “virtualfund.mxo”?
The searchpath can be a funny thing. Did you add the folder with your Xcode project in it to your searchpath. There are lots of things with the name of your object buried in the build folders that will conflict with your mxo when Max tries to load them.
Apr 21, 2010 at 10:38pm
I guess the problem was in the Xcode project settings – in fact I realize that I had made an ugly mix of things from different versions of the SDK.
I made a new project, named it “virtfund” (even nicer, in fact!), changed what had to be changed in the source and now it works like a charm.
Thanks to everyone!
You must be logged in to reply to this topic.