Max 5 API Reference
Max maintains a symbol table of all strings to speed lookup for message passing. More...
![]() |
Data Structures | |
struct | t_symbol |
The symbol. More... | |
Functions | |
t_symbol * | gensym (char *s) |
Given a C-string, fetch the matching t_symbol pointer from the symbol table, generating the symbol if neccessary. |
Max maintains a symbol table of all strings to speed lookup for message passing.
If you want to access the bang symbol for example, you’ll have to use the expression gensym("bang"). For example, gensym() may be needed when sending messages directly to other Max objects such as with object_method() and outlet_anything(). These functions expect a t_symbol*, they don’t gensym() character strings for you.
The t_symbol data structure also contains a place to store an arbitrary value. The following example shows how you can use this feature to use symbols to share values among two different external object classes. (Objects of the same class can use the code resource’s global variable space to share data.) The idea is that the s_thing field of a t_symbol can be set to some value, and gensym() will return a reference to the Symbol. Thus, the two classes just have to agree about the character string to be used. Alternatively, each could be passed a t_symbol that will be used to share data.
Storing a value:
Retrieving a value:
t_symbol* gensym | ( | char * | s | ) |
Given a C-string, fetch the matching t_symbol pointer from the symbol table, generating the symbol if neccessary.
s | A C-string to be looked up in Max’s symbol table. |
Referenced by db_open(), db_view_create(), db_view_getresult(), db_view_remove(), db_view_setquery(), jit_attr_offset_array_new(), jit_attr_offset_new(), jit_attribute_new(), jit_bin_read_matrix(), jit_bin_write_matrix(), jit_class_method_addargsafe(), jit_class_method_argsafe_get(), jit_class_new(), jit_mop_input_nolink(), jit_mop_io_new(), jit_mop_new(), jit_mop_newcopy(), jit_mop_output_nolink(), jit_mop_single_planecount(), jit_mop_single_type(), jit_ob3d_setup(), jit_object_exportattrs(), jit_object_importattrs(), jit_qt_movie_matrix_calc(), jit_qt_movie_matrix_to_image(), jit_qt_movie_new(), jit_qt_record_new(), jit_qt_utils_moviedataref_create(), jit_qt_utils_tempmoviefile_create(), jit_qt_utils_trackname_get(), jit_qt_utils_tracktype_get(), jit_qt_utils_tracktypecode_get(), max_jit_attr_args(), max_jit_attr_get(), max_jit_attr_getdump(), max_jit_mop_variable_addinputs(), max_jit_mop_variable_addoutputs(), max_jit_obex_gimmeback_dumpout(), and max_jit_obex_jitob_set().