Mark some globals as extern to fix compilation if g_canvas.h is included more than once
Jean-Michaël Celerier from the OSSIA project submitted this here in order to resolve some compilation problems due to our version of the g_canvas.h header. The problem was originally reported here, and was noticed while trying to get libossia's Pd external to work with Purr Data.
OSSIA is an interesting new multimedia sequencer program being developed at the University of Bordeaux, which interfaces to a number of different environments including Max and Pd. I'm using it along with Pd in one of my university courses this semester, and so I asked Jean-Michaël to help me get it working with Purr Data.
The ossia-pd external is needed to interface between the OSSIA score editor and Pd. It compiles fine against vanilla, but not against Purr Data right now. The obvious culprit here is our version of the g_canvas.h header. Specifically, it contains four globals array_garray
, preset_hub_class
, preset_node_class
and array_joc
, which are actually defined in the header file, rather than just being declared and then defined in the corresponding .c file. Which of course causes trouble when the g_canvas.h file gets included more than once in different parts of another module.
These globals were introduced in rev. f82f3092 and 4f9cc742, i.e., back in the pd-extended/pd-l2ork1 days a long long time ago. The fix of course is to properly declare these as extern in the header file and define them in the g_canvas.c file. Which is exactly what Jean-Michaël did here.
I tested this on (Arch) Linux, works fine for me.