Anarres

CLORB: CORBA for Lisp

December 31, 2006 · 2 Comments

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.

Categories: Software

2 responses so far ↓

  • Zach // January 2, 2007 at 5:19 pm

    FYI, your code examples won’t work as written…your blogging software has converted plain double-quotes into left and right “smart” quotes. Maybe wrapping it in PRE tags would help?

  • Michael // March 22, 2007 at 5:03 pm

    I am trying to write an rss aggregator/text tagger in clisp which will (hopefully) expose all generated content-objects through CORBA to our J2EE CMS for import operations. I’ve decided to do this in Lisp in order to learn the language, besides XML processing has been very straight-forward so far. I’m stuck, however, when it comes to registering objects with the name service - I keep getting InvalidName exceptions when i try to use (clorb:rebind…

    (defvar *object* (op:activate_object *poa* *servant*))
    (clorb:rebind *object* “my-name” ;)

    Could you maybe provide a minimal working example of CLORB being used as a NameService provider, with emphasis on registering objects with the name service?

    Thanks, M.

Leave a Comment