NextPrevUpTopContentsIndex

2.1.4 Implementing the client

Now we will implement the client side of the Hello World application. We create a file hello-world-client.lisp and add it to the defsystem. (You can implement this as you wish, but here is one possible implementation.)

  1. Create a file called hello-world-client.lisp .
  2. Enter the following Common Lisp code into the
    hello-world-client.lisp file:
  3. (in-package "CL-USER")
     
    (defun run-client ()
      (let ((orb (op:orb_init nil "LispWorks ORB")))
        (let ((world (op:narrow 'HelloWorld:world (file-to-object
                                                   orb))))
          (format t "~S~%" (op:hello world)))))

    This code does the following:

    The elided details are not important at this stage, they involve getting an object reference from somewhere. In the full source at the end of this chapter (Complete source code for the Hello World example) you can see that a shared file is used to pass a stringified object reference.

  4. Save and close the hello-world-client.lisp file.
  5. Add hello-world-client to the defsystem by adding one line of code to the defsys.lisp file, which should then look like this:
(in-package "CL-USER") (require "corba-orb")
(defsystem hello-world-corba-object ()
  :members (
            ("hello-world" :type :idl-file)
            "shared"
            "hello-world-client"
            ))
:rules ((:in-order-to :compile "all
         (:requires (:load :previous)))))

Developing Component Software with CORBA - 30 Oct 2007

NextPrevUpTopContentsIndex