CLORB: CORBA for Lisp December 31, 2006

Well, I thought about it for awhile and decided I would post something about CLORB in particular. Where I work we use CORBA as the transport for our grids. I have always wanted to be able to use Lisp as a client– yay! CLORB. Now, I know there are other CORBA implementations for Lisp– but this one is free. That last word there– free– is very, very important when you are trying to establish a foothold for Lisp in the corporate IT world. I use SBCL on Linux and CLISP on Windows because they are free. That means I don’t have to go through the entire process of requesting funds for LispWorks or ACL. Which, also means, I don’t have to justify an expense for something no one else in the company for which I work is using. So, now that I have free Lisp tools and CLORB I can interoperate with all of the other services that have been developed in other languages at the company I work. The interesting thing about this use of free tools is that once I have a few projects/services in place using Lisp I can justify actually buying LispWorks or ACL if needed. Now back to CLORB– I was very happy at how easy it was to get a client up and talking to a python service. I am using OmniNames as my nameservice. The following snippet will enable the connection and use of a corba service– in this case the python corba service provides a single method called getsyphs.

(require :asdf) (require :sb-bsd-sockets) (require :clorb) (defvar *orb* (CORBA:ORB_init (list "-ORBInitRef" "NameService=corbaloc::10.85.90.144:2809/NameService"))) (corba:idl "syph.idl") (defvar *obj* (op:resolve_initial_references *orb* "NameService")) (defvar *rc* (op:narrow 'cosnaming:namingcontextext *obj*)) (defvar syph (op:resolve "BCS.syph/BCSSyph.Object")) (defvar rt (op:narrow 'BCS:Syph syph)) (op:getsyphs rt "014600AIR CANADA")

The only downside I have experienced with CLORB is that it depends on cpp to preprocess idl. This is a small problem if you are on Windows and don’t have a cpp. I got around it by having CLORB generate all of the Lisp code to a single file for the idl on Linux.

(CORBA:IDL "syph.idl" :output "syph.lisp")

Then in CLISP on my Windows box I replaced

(corba:idl "syph.idl")

with

(load "syph.lisp")

and all was happy.