[PD-dev] Pd 0.42-0 test 6 available

Martin Peach martin.peach at sympatico.ca
Thu Dec 11 19:54:02 CET 2008

IOhannes m zmoelnig wrote:
>Hans-Christoph Steiner wrote:
> > IOhannes m zmoelnig wrote:
> >> speaking of adding things to the Pd API...
> >> is it totally out of your ways to
> >> - add a function that returns the version of Pd?
> >> something like "const char* pd_versionstring(void)" would be nice.
> >> this could be used to ensure that an external is running with a Pd
> >> version compatible to the one it was compiled against
> >
> > Since the version will most likely be used for a numeric comparison, and
> > it is stored as a number, perhaps it makes sense to return numeric types
> > instead of a char*?
> >
> > int pd_majorversion(void)
> > int pd_minorversion(void)
> > int pd_bugfixversion(void)
>personally i don't care so much for the details.
>i proposed the string as it outputs the full version number (with all
>"test" and whatnot).

Why not add 4 global variables

EXTERN t_int pd_majorversion;
EXTERN t_int pd_minorversion;
EXTERN t_int pd_bugfixversion;
EXTERN t_symbol pd_testversion;

...to m_pd.h, which would be initialized when pd starts up from the #defines

Or make it a struct:

typedef struct
  t_int       major_version;
  t_int       minor_version;
  t_int       bugfix_version;
  t_symbol test_version;
} t_pd_version;
EXTERN t_pd_version pd_version;


More information about the Pd-dev mailing list