[PD] gate object changing type - ?

Mathieu Bouchard matju at artengine.ca
Sun Nov 12 21:15:06 CET 2006


On Sun, 12 Nov 2006, Mathieu Bouchard wrote:

> I think that for that kind of problem it could be a good idea to have a new 
> call in m_pd.h in which an external states to pd what its interpretation of 
> m_pd.h's structs is, so that pd can detect problems. e.g. m_pd.h could 
> contain a statement-like macro and a function decl:
> #define pd_begin_setup() pd_make_sure(sizeof(t_text))
> EXTERN pd_make_sure(size_t sizeof_text);

Actually, we don't need pd to check it for us, and we don't even need to 
call a function to get the size of a class. E.g.

#include <stdio.h>
#include "m_pd.h"
#include "m_imp.h"

extern t_class *text_class;

void sanity_setup (void) {
   post("t_text is %d bytes according to pd", text_class->c_size);
   post("t_text is %d bytes according to me", sizeof(t_text));
}

So if text_class->c_size != sizeof(t_text) then the externals compiled 
with the same options as this external will not be compatible with the pd 
that loaded -lib sanity.

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montréal QC Canada


More information about the Pd-list mailing list