The Do-It Yourself Guide to Squeak Primitives


10. Add Function Prototype(s) to the Squeak Header file

In order for the primitive call (in interp.c) to work, you need to provide a function prototype (at least if you use a C compiler that requires them, which you should). In the main Squeak header file--sq.h--I added,

/* MIDI Prims */         // Added by STP
#include "OMS.h" // OMS definitions and structs
#include <MIDI.h> // Apple MIDI Libraries
#include "sqMIDI.h" // Squeak MIDI Structs and Prims

 

and in my package's header file sqMIDI.h  I have,

int sqReadMIDIPacket(int MIDIpacket, int dataBuffer);

Note that I have to include another header file for the OMS libraries, and to include the Apple MIDI library. This would not be necessary for a simpler primitive that had less (baggage) of its own.