Hello. My name is Rob Bairos, Director of R+D at www.derivative.ca Ive exchanged a couple brief messages with Peter Brinkmann. Im interested in finding out what would be involved in making pdlib support multiple instances.
From my understanding, the current proposed solution is to take all statics
and globals, encapsulate them in one object, and pass that object to all api calls. Peter further suggested legacy api is maintained by having them call the new api with a default instance object.
I did a little bit of hunting, using objdump on the current dll, to get a rough list of all the globals and statics currently involved.
Im thinking the *_class and *_sym static pointers are in fact constant, and need only one shared instance. That would leave about 320 variables remaining. Many of these variables are constant arrays, strings, etc. And many seem to be used only as a shortcut for passing data between two functions, possibly bringing down the number further.
Im toying with the idea of taking on this task if anyone's interested. I may require some tips and help from the forum, in terms of creating a branch, explanation of some statics etc.
So how feasible is this? Am I on the right track? Thanks very much, Rob Bairos.
PS. Im including the relevant variable list below if anyone's curious.
-------------- rdata Section -------------- iemgui_vu_scale_str iemgui_vu_col iemgui_vu_db2i iemgui_color_hex garray_widgetbehavior glist_valid graph_widgetbehavior drawnumber_widgetbehavior plot_widgetbehavior curve_widgetbehavior text_widgetbehavior s_ s_y s_x s__X s__N s_signal s_anything s_list s_bang s_float s_pointer sys_schedblocksize sys_audioapiopened sys_audioapi sys_flags sys_fontweight sys_font sys_midioutdevlist sys_midiindevlist sys_nmidiin sys_nmidiout sys_hipriority pd_compiledate pd_compiletime pd_version sys_usestdpath sinwrk coswrk init.3151 garray_floattemplatefile garray_arraytemplatefile dollarzero.6960 canvas_newdirectory canvas_newfilename scalar_widgetbehavior gatom_widgetbehavior sys_mutex sched_useaudio audio_advance audio_naudiooutdev audio_naudioindev loaders sys_dllextent2 sys_dllextent sys_fontlist sys_nchout sys_nchin sys_nsoundout sys_nsoundin random_nextseed.60641 p.57111 c1 c0 fpi.5824
-------------- .bss Section -------------- ntab stab lsec gdoo.5287 rsorlist s_errornames faultfontshit agemessage ailingBytesForUTF8 fsetsFromUTF8
-------------- .edata Section -------------- glist_amreloadingabstractions sys_nosleep libpd_midibytehook libpd_polyaftertouchhook libpd_aftertouchhook libpd_pitchbendhook libpd_programchangehook libpd_controlchangehook libpd_noteonhook libpd_messagehook libpd_listhook libpd_floathook libpd_banghook libpd_printhook cos_table bng_widgetbehavior canvas_editing canvas_list canvas_dspstate canvas_whichfind hradio_widgetbehavior hslider_widgetbehavior my_canvas_widgetbehavior my_numbox_widgetbehavior toggle_widgetbehavior vradio_widgetbehavior vslider_widgetbehavior vu_widgetbehavior newest pd_canvasmaker pd_objectmaker glob_pdobject sys_perf sys_idlehook sys_sleepgrain clock_setlist sys_time sys_time_per_dsp_tick sys_advance_samples sys_dacsr sys_outchannels sys_soundin sys_schedadvance sys_inchannels sys_soundout sys_defeatrt sys_externalschedlibname sys_noloadbang sys_debuglevel sys_verbose sys_noautopatch sys_extraflagsstring sys_oldtclversion sys_defaultfont sys_nogui sys_libdir sys_guicmd sys_guisetportnumber sys_externalschedlib sys_extraflags sys_externlist sys_helppath sys_searchpath sys_staticpath sys_printhook sys_printtostderr firstnet rsqrt_mantissatab rsqrt_exptab ugen_currentcontext ugen_sortno signal_usedlist signal_freeborrowed signal_freelist dsp_phase dsp_chainsize dsp_chain array_motion_fatten array_motion_lastx array_motion_yperpix array_motion_xperpix array_motion_initx array_motion_elemsize array_motion_npoints array_motion_template array_motion_wp array_motion_array array_motion_scalar array_motion_glist array_motion_yfield array_motion_xfield array_motion_ycumulative array_motion_xcumulative garray_arraytemplatecanvas warned.7436 gcount.6988 tabcount canvas_newargv canvas_newargc keynamesym.7202 keyupsym.7201 keynumsym.7200 cursorwas.6895 xwas.6894 reenter.6640 canvas_last_glist_y canvas_last_glist_x canvas_last_glist paste_canvas paste_onset canvas_findbuf canvas_find_wholeword canvas_find_index2 canvas_find_index1 canvas_upy canvas_upx canvas_upclicktime canvas_undo_already_set_move canvas_undo_name canvas_undo_canvas canvas_undo_buf canvas_undo_whatnext canvas_undo_fn copy_binbuf rtext_entered warned.6667 drawnumber_motion_firstkey drawnumber_motion_gpointer drawnumber_motion_template drawnumber_motion_wp drawnumber_motion_array drawnumber_motion_scalar drawnumber_motion_glist drawnumber_motion_ycumulative curve_motion_gpointer curve_motion_template curve_motion_wp curve_motion_array curve_motion_scalar curve_motion_glist curve_motion_yper curve_motion_ybase curve_motion_ycumulative curve_motion_xper curve_motion_xbase curve_motion_xcumulative curve_motion_field tryingalready maxclass outlet_eventno stackcount pd_loadingabstraction lastpopped gstack_head idletime.59619 sched_nextmeterpolltime.59581 sched_referencelogicaltime sched_referencerealtime sched_lastoutdb sched_lastindb sched_lastoutclip sched_lastinclip sched_meterson sched_dioredtime sched_diored oss_resync oss_nresync oss_resyncphase sys_histphase sched_didnothing sched_didpoll sched_diddsp sys_histtime sys_histogram sys_quit initted.5834 audio_nextoutchans audio_nextinchans audio_callback_is_open audio_blocksize audio_callback audio_rate audio_audiochoutdev audio_audiooutdev audio_audiochindev audio_audioindev audio_state sys_outmax sys_inmax sys_meters reentered.61489 sys_bytessincelastping sys_waitingforping sys_guibufsize sys_guibuftail sys_guibufhead sys_guibuf sys_guiqueuehead nt_freq nt_inittime sys_socketreceiver inbinbuf sys_guisock sys_maxfd sys_fdpoll sys_nfdpoll sys_loaded sys_choutlist sys_chinlist sys_soundoutdevlist sys_soundindevlist sys_batch sys_listplease sys_main_blocksize sys_main_callback sys_main_advance sys_main_srate sys_version sys_messagelist sys_openlist saidit.5587 errstring errobject error_string error_object gfxstub_binbuf gfxstub_list count.2506 prev.2505 lastwarntime.58421 pleasewarn.58422 argc argm curr argv initialized freelist