[CM] linux, sbcl, osc patch

Fernando Lopez-Lezcano nando at ccrma.Stanford.EDU
Mon, 03 Dec 2007 10:58:56 -0800


I had to add this patch to osc-1.0.1 for it to work (well, don't really
know if it works, not completely tested) on linux/sbcl. 

This was due to a bug report from Joakim in the Planet CCRMA list:

On Sat, 2007-12-01 at 23:02 +0100, joakim@verona.se wrote: 
> Fernando Lopez-Lezcano <nando@ccrma.Stanford.EDU> writes:
> > Looks like an old bug:
> >
> > http://ccrma-mail.stanford.edu/pipermail/cmdist/2007-May/004084.html
> >
> > I did a quick build including osc and seems to work (includes a
> > workaround for the package locking bug)
> >
> > http://www.sbcl.org/manual/Package-Lock-Dictionary.html
> >
> > I used "without-package-locks" when compiling and loading osc. 
> >
> > Tested only to the extent that it loads in a chroot. 
> > Hope it works for you. 
> 
> Now I get a small step further:
> 
> (use-system :osc)
> (defvar *osc-stream* (new osc-stream :remote-host "127.0.0.1"
> :remote-port 5400))
> (open-io *osc-stream* t)
> 
> open-io complains that make-udp-socket is undefined.
> 
> It is declared in sockets.lisp in the osc dir, but its not immediately
> obvious how open-io is supposed to know that.

I don't know why the in-package sb-alien is not doing its job. 
As is, the functions following the in-package cm are defined in the 
sb-alien package. Prefixing the alien functions and removing the 
in-package sb-alien make the call work. 

-- Fernando



--- osc/sockets.lisp~	2007-12-02 19:13:13.000000000 -0800
+++ osc/sockets.lisp	2007-12-02 19:28:54.000000000 -0800
@@ -73,30 +73,25 @@
     (ccl::send-to sock mess len)))
 
 
-#+sbcl
-(in-package :sb-alien)
-
 #+sbcl 
 (progn
   ;;;
 ;;; sbcl alien stuff for sendto 
-  
+
   #+darwin (load-shared-object "libc.dylib")
   
-  (define-alien-type ssize_t int)
+  (sb-alien:define-alien-type ssize_t sb-alien:int)
   
-  (define-alien-type size_t int)
+  (sb-alien:define-alien-type size_t sb-alien:int)
   
-  (define-alien-type sockaddr (struct
SB-BSD-SOCKETS-INTERNAL::SOCKADDR-IN))
+  (sb-alien:define-alien-type sockaddr (sb-alien:struct
SB-BSD-SOCKETS-INTERNAL::SOCKADDR-IN))
   
   (declaim (inline sendto))
   
-  (define-alien-routine ("sendto" sendto)
+  (sb-alien:define-alien-routine ("sendto" sendto)
     ssize_t
-    (s int) (msg (* t)) (len ssize_t) (flags int) (to (* sockaddr))
(tolen int))
-  
-  (in-package :cm)
-  
+    (s sb-alien:int) (msg (* t)) (len ssize_t) (flags sb-alien:int) (to
(* sockaddr)) (tolen sb-alien:int))
+
   (defclass udp-socket (sb-bsd-sockets::inet-socket)
     ((sb-bsd-sockets::protocol :initform :udp)
      (sb-bsd-sockets::type :initform :datagram)