[PD-dev] Double precision externals extensions.

Christof Ressi christof.ressi at gmx.at
Tue Dec 10 23:55:01 CET 2019


pretty complicated for many people, I guess. Maybe there's a way to automate this?

One idea: 

add a macro for setup functions:

#ifdef DOUBLEBUILD
  #define SETUP(setup) ... // mangle "setup" based on PD_FLOATSIZE
#else
  #define SETUP(setup) setup
#endif

add another macro:

#if defined(DOUBLEBUILD) && PD_FLOATSIZE == 32
  #define EXPORT(setup) EXTERN void setup { ... call both setup functions ... } // only export in one file
#else
  #define EXPORT(setup) EXTERN void setup; // just redeclare as extern
#endif

Usage:

void SETUP(foo_setup) { ... }

EXPORT(foo_setup)

If you define DOUBLEBUILD, compile the .c file two times (one with -DPD_FLOATSIZE=32 and the other with -DPD_FLOATSIZE=64) and link both .o files, you get a single exported setup function which calls both private setup functions. This could be done automatically by pd-lib-builder when requested.

Just some brainstorming.

Christof

> Gesendet: Dienstag, 10. Dezember 2019 um 23:06 Uhr
> Von: "IOhannes m zmölnig" <zmoelnig at iem.at>
> An: pd-dev at lists.iem.at
> Betreff: Re: [PD-dev] Double precision externals extensions.
>
> On 12/10/19 10:48 PM, Christof Ressi wrote:
> > 
> > I'm also interested in how this works. The following solution popped up in my head: compile the object twice, one time with -DPD_FLOATSIZE=32 and another time with -DPD_FLOATSIZE=64, with different setup functions based on -DPD_FLOATSIZE, then link it with a third file which exports the "real" setup function (which calls the other two private setup functions).
> > 
> 
> that's about the idea.
> 
> gdsa r
> IOhannes
> 
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
>





More information about the Pd-dev mailing list