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.)
hello-world-client.lisp. 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:
op:hello on the object to get a stringThe 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.
hello-world-client.lisp file. hello-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)))))