Min Devkit: Unable to call Max Macros in Maxclass_setup
Greetings,
i'm trying to get this example from the Min documentation to run:
// the "maxclass_setup" method is called when the class is created
// it is not called on an instance at what we think of in Max as "runtime"
message<> maxclass_setup { this, "maxclass_setup",
MIN_FUNCTION {
c74::max::t_class* c = args[0];
CLASS_ATTR_ENUM(c, "shape", 0, "linear equal_power square_root");
CLASS_ATTR_LABEL(c, "shape", 0, "Shape of the crossfade function");
return {};
}
};
But when I do that, the linter gives an error gensym is unidentified. I tried expanding the macro and putting c74::max in front of all the max terms. But this causes a "read access violation" hard crash when the object loads. Is there any

asdf
do you have a "shape" attribute added to your object?
i changed "shape" to the name of an attribute in my object. The error didn't change.
Ultimately I'm trying to declare an attribute in maxclass_setup rather than through Min's templates.... for reasons that might be stupid.
Messing with any of this probably requires a lot more knowledge of Max SDK than I currently have. I'm happy to leave this and find a different way to achieve my goal.
Hi,
You can use the "Expand Inline" option here to see what the macro expands to and what the error is. In this case, using namespace c74::max
will solve it:
message<> maxclass_setup { this, "maxclass_setup",
MIN_FUNCTION {
using namespace c74::max;
c74::max::t_class* c = args[0];
CLASS_ATTR_ENUM(c, "shape", 0, "linear equal_power square_root");
CLASS_ATTR_LABEL(c, "shape", 0, "Shape of the crossfade function");
return {};
}
};
Thanks JBG, i did try that and got the code to compile. But then Max crashed with with a "read access violation" when I tried loading my object. I suspect that's coming from my ignorance of the Max SDK. It sounds the thing I'm trying to do here would better achieved with the "setup" message. I'll give that a shot instead.
sorry about all of this. I forgot that you can just use the max namespace inside a block.
{
using c74::max
//all the max macros you could ever want...
}
//back to min world
Maybe one day I will learn more about about Max SDK. It seems like you might be able to write your entire object in here? Or maybe you can just create a big mess.