[Vm-dev] Newbie problem porting PortMidi to Squeak (Mac Intel)

Simon Holland s.holland at open.ac.uk
Fri Aug 24 15:58:57 UTC 2007

Dear All
I am writing primitives to port Stephen Pope’s portmidi_lite VisualWorks
plugin to Squeak (on Mac Intel for now).

To test everything possible before linking to the portmidi library, I wrote
a series of test plugins using the arguments, return types, and pointer
manipulation etc required by portmidi_lite. These show that the primitives
do the appropriate proxyinterpreter stack manipulation, type conversion and
object creation while avoiding garbage collection, and generally exchange
data just fine with the test plugins.

But to transfer this to portmidi_lite, the portmidi library must be linked
in. After removing the VW-specific includes from Stephen's portmidi_lite.c
(renamed as noted below) and supplying the necessary .h’s , the make
compiles and links without error. 

However, the plugin then fails to load at runtime. 

More specifically, when I run the automatically generated make to rebuild
the VM/plugins and to link my slang-generated glue code to portmidi_lite.c
and to the portmidi library, this all runs to completion and compiles with
no errors. The plugin is created and put in the right place (as an external)
and looks sensible via nm. However, the plugin fails to load at run-time.

On attempting to load the plugin, Squeak complains to the console
“ioLoadModule  could not load shared object:
This message originates from vm/dlfcn-dyld.c , where it wraps a Mach error
code NSObjectFileImageInappropriateFile – ‘file was not an appropriate type
of object file’.

In the Makefile.inc for linking the portmidi plugin, I have


The folder i386 contains

The contents of this folder is a fresh build of the portmidi library for
intel Mac created using the Xcode project provided by the portmidi guys.
(The previous attempt, using just the single file libportmidi.a in this
folder gave the same result.)

For completeness, up a level at
we have the following files 
   SirenDLLCC.h   (this just includes debug defines)
(a renamed version of portmidi_lite.c with the VW includes removed – this
has includes for the four .h’s)

Any thoughts would be greatly appreciated.

Simon Holland

(Cross posted to squeak audio and vw-dev)

View this message in context: http://www.nabble.com/Newbie-problem-porting-PortMidi-to-Squeak--%28Mac-Intel%29-tf4324379.html#a12315157
Sent from the Squeak vm-dev mailing list archive at Nabble.com.

More information about the Vm-dev mailing list