Hi, I created a issue on the libPd repository ( https://github.com/libpd/libpd/issues/196) but perhaps it's more related to Pd itself.
When I load a patch with [text define], it crashes (x_text.c line 280) because x->x_scalar is NULL (because in scalar_new(), the function template_findbyname(templatesym) returns NULL). So it seems that the function can't find a template linked with the symbol "pd-text".
I can't figure out why it works in Pd but not in libPd. Perhaps, libPd don't call a method to bind a template to this symbol at startup? Or perhaps it's related to the fact that I use PDINSTANCE and PDTHREADS? I can't figure out the solution so any idea is welcomed!
Cheers, Pierre
I investigated and here is what I found: At initialization, pd_init() calls conf_init() (m_pd.c l.311) that calls x_qlist_setup() (m_conf.c l.91) that calls text_template_init() (x_text.c l.1970) etc. that ends by calling template_new() that binds a template to the the symbol "pd-text" (g_template.c l.154). This binding is only valid at initialization and is not duplicated when using new pdinstances that why it crashes. I guess there is the same problem with the symbols "pd-float" and "pd-float-array" with garray_init(). I'll try to find a solution now.
2017-11-02 12:07 GMT+01:00 Pierre Guillot guillotpierre6@gmail.com:
Hi, I created a issue on the libPd repository (https://github.com/libpd/ libpd/issues/196) but perhaps it's more related to Pd itself.
When I load a patch with [text define], it crashes (x_text.c line 280) because x->x_scalar is NULL (because in scalar_new(), the function template_findbyname(templatesym) returns NULL). So it seems that the function can't find a template linked with the symbol "pd-text".
I can't figure out why it works in Pd but not in libPd. Perhaps, libPd don't call a method to bind a template to this symbol at startup? Or perhaps it's related to the fact that I use PDINSTANCE and PDTHREADS? I can't figure out the solution so any idea is welcomed!
Cheers, Pierre