Next Previous Up Top Contents Index

2.1 A CORBA-based Hello World

2.1.4 Implementing the client

Now we will implement the client side of the Hello World application. We create a filehello-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 calledhello-world-client.lisp.
2. Enter the following Common Lisp code into the
hello-world-client.lisp file:
(in-package "CL-USER")
(defun run-client ()
  (let ((orb (op:orb_init nil "Harlequin Common Lisp 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 (Section 2.2) you can see that a shared file is used to pass a stringified object reference.

3. Save and close thehello-world-client.lisp file.
4. Addhello-world-client to the defsystem by adding one line of code to thedefsys.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 - 22 Jan 1999

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker