From: Kucera, Rich
Subject: stuck: acl ole problem
Date: 
Message-ID: <80C621FFC2DFD2119FFF00805FA7C54F03011CAF@exchange1.hhmi.org>
Group,
Been trying to get ACL5 to talk to ActiveState PerlCOM,  I seem to be
able to get a 
handle on the object and then release it,   but haven't been able to do
more than that.
Anyone know any OLE who might know the problem?   Here's the listener
session
followed by the source code for perl.cl.   Thought I could get there by
example,  but
now I'm stuck...TIA

[starting off with description of key method "ole::auto-method"]

> (ole::auto-method
ole:auto-method is a symbol.
  It is unbound.
  It is external in the OLE package.
  Its function binding is #<standard-generic-function ole:auto-method>
    The function takes arguments (tool method-name &rest args)

> 
; Loading D:\acl50lite\ole\samples\activePerl\perl.cl


> (test)


Starting OLE PerlCOM test.


"something there" excepinfo is
Foreign object of type ole:excepinfo and allocation :c

    struct:
    ole::wcode: 5 == #x5
    ole::wreserved: 0 == #x0
    ole::bstrsource: 131090 == #x20012
    ole::bstrdescription: 1445988949 == #x56300a55
    ole::dwhelpcontext: 548127898 == #x20abc49a
    ole::pvreserved: 5 == #x5
    ole::pfndefferedfillin: 131090 == #x20012
    ole::scode: 942670846 == #x383003fe
Error: ole returned an error #x80020003 (code: #x3, facilty: #x2)

> 

I know the facility is the dispatcher,  the code is something fatal?

Here's perl.cl

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Sample program illustrating the use of an autotool object
;; to drive an inproc automation server.
;;
;; Compile and Load this file, then evaluate (test)
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(in-package :user)

;; Compiling OLE source needs the OLE Development tools.

(eval-when (compile eval)
  (require :ole-dev))

;; Running OLE source requires the OLE Runtime package.

(eval-when (load eval)
  (require :ole))

;; We need to know the classid of the object we intend to create
;; We'll put it in the preferred form by using unique-guid.

(defparameter perl-classid
 (ole:unique-guid "{B5863EF3-7B28-11D1-8106-0000B4234391}"))

;; PerlCOM.Script 	{B5863EF3-7B28-11D1-8106-0000B4234391}
;; PerlCOM type library	{B5863EF1-7B28-11D1-8106-0000B4234391}

(defun test ()

  ;; muffle gc reports

  (setf (sys:gsgc-switch :print) nil)

  ;; first check the registry to be sure PerlCOM is out there

  (ole:with-open-registry-key (perl-reg ole:rkey-classes-root
				       `("CLSID" ,(ole:guid-name
perl-classid))
				       :error-return nil)
     (when (null perl-reg)
	   (format t "Sorry, no PerlCOM on this system~2%")
	   (return-from test nil)))

  ;; We need a fanfare.
  (format t "~2%Starting OLE PerlCOM test.~2%")

  ;; just in case ole hasn't yet been started ...

  (ole:start-ole)

  ;; we allocate a single,  so we don't bother with a factory

  (let ((perltool (ole:ask-for-autotool
		  perl-classid
		  ole:CLSCTX_INPROC_SERVER)))

    ;; now that we have one, we'll poke at it a bit

     (if (null perltool) (print "it's null") (print "something there"))

;;     (let ((hash (ole::auto-method perltool :CreateObject))))

    (ole::auto-method perltool :EvalScript "$greeting='hello world!';")
    
    ;; also can use setf on the auto-getf form to change a property
value.
    ;; (setf (ole:auto-getf perltool :day) 7)

;;    (format t "... and then PerlCOM said: ~A"
;;	    (ole:auto-getf perltool :greeting))

    ;; now we're done, we'll let the PerlCOM go away

    (ole:release perltool)

    ;; A closing note.

    (format t "~2%The PerlCOM test is complete.~2%")

    (values)))


;; When it's time to leave, we stop ole and exit

(defun done ()
  (ole:stop-ole)
  (exit 0))

From: John Wiseman
Subject: Re: stuck: acl ole problem
Date: 
Message-ID: <arxlnd1354t.fsf@gargoyle.cs.uchicago.edu>
"Kucera, Rich" <·······@hhmi.org> writes:

> Group, Been trying to get ACL5 to talk to ActiveState PerlCOM, I
> seem to be able to get a handle on the object and then release it,
> but haven't been able to do more than that.  Anyone know any OLE who
> might know the problem?

I've spent a couple hours using the OLE stuff (so I barely know what
I'm doing), but I don't see anything obviously wrong with your code.

Is it possible that you're not calling EvalScript the right way, or
that EvalScript doesn't exist as a method?  The error you're getting
is named DISP_E_MEMBERNOTFOUND, which makes me suspect that EvalScript
might not exist.

If there is an EvalScript method, is it possible that the error is
occurring inside the method?  Maybe it's trying to tell you that an
error occurred during evaluation.  You could try something simpler and
see if that works.

Is it possible that this PerlCOM thing is an out-of-process server?
This seems unlikely, since you appear to successfully get something
back from ole:ask-for-autotool.

Finally, the only difference betwen your code and mine is that I call
ole:ask-for-autotool with a ProgID string (like "MDDatalink.ExtFace")
instead of a class ID thing.  I don't think this should make any
difference, but if you can't find anything else wrong it might be
worth trying to both ways.

The OLE interface is pretty cool.  It would be great if there were
some higher-level code available for using collections and handling
events (there is some sample code that does event handling, but I
haven't been able to get it to run.)  It's no big deal, I'm just
spoiled and don't want to write the grungy code for it myself.

Performance was quite poor.  Maybe it has been improved in 5.01, which
I haven't tried.  In most cases I'll take easy to use over really
fast, anyway.


John Wiseman

P.S. If comp.lang.lisp.franz is now the de facto ACL newsgroup, maybe
this should be discussed there instead of comp.lang.lisp.
From: Kucera, Rich
Subject: stuck: acl ole problem
Date: 
Message-ID: <80C621FFC2DFD2119FFF00805FA7C54F0302023E@exchange1.hhmi.org>
Thanks for response!  See more below

-----Original Message-----
From: ·······@gargoyle.cs.uchicago.edu
[··············@gargoyle.cs.uchicago.edu]On Behalf Of
·······@cs.uchicago.edu (John Wiseman)
Posted At: Wednesday, June 30, 1999 2:39 PM
Posted To: lisp
Conversation: stuck: acl ole problem
Subject: Re: stuck: acl ole problem


"Kucera, Rich" <·······@hhmi.org> writes:

> Group, Been trying to get ACL5 to talk to ActiveState PerlCOM, I
> seem to be able to get a handle on the object and then release it,
> but haven't been able to do more than that.  Anyone know any OLE who
> might know the problem?

I've spent a couple hours using the OLE stuff (so I barely know what
I'm doing), but I don't see anything obviously wrong with your code.

Is it possible that you're not calling EvalScript the right way, or
that EvalScript doesn't exist as a method?  The error you're getting
is named DISP_E_MEMBERNOTFOUND, which makes me suspect that EvalScript
might not exist.

	:It shows up in VBA for windows object browser.  PerlCOM works
ok
	:from there

If there is an EvalScript method, is it possible that the error is
occurring inside the method?  Maybe it's trying to tell you that an
error occurred during evaluation.  You could try something simpler and
see if that works.

	:No that's legal Perl.   In fact all I'm trying to do is an
	:assignment statement.   But I'm not clear on how to pass the
	:string over that contains the script,  either.  It's not a	
	:property,  it's a "&rest" argument.

Is it possible that this PerlCOM thing is an out-of-process server?
This seems unlikely, since you appear to successfully get something
back from ole:ask-for-autotool.

	:No,  in process.  How can I look at "perltool", the thing
returned
	:from ole::ask-for-autotool?  It's not null.  Er...debugger says
	:this about it-
((method auto-method (remote-autotool t)) #<remote-autotool> evalscript
$greeting='hello world!';)

	:Inspector on remote autotool gives me what appears to be a
valid
	:object with type, dispatch and op-map properties...whatever
that means-

'ole:remote-autotool
#<ole::idispatch-client:7567640>
(("EVALSCRIPT" 6))

	:that's all for now...wonder why it's upcase there?  think this
would break it?

Finally, the only difference betwen your code and mine is that I call
ole:ask-for-autotool with a ProgID string (like "MDDatalink.ExtFace")
instead of a class ID thing.  I don't think this should make any
difference, but if you can't find anything else wrong it might be
worth trying to both ways.

	:OK,  tried it.  Different error codes, looks like...how
	:do I find out what these mean anyway?
		excepinfo is
		Foreign object of type ole:excepinfo and allocation :c

		    	struct:
			ole::wcode: 2437 == #x985
    			ole::wreserved: 8192 == #x2000
    			ole::bstrsource: 541292850 == #x20437932
    			ole::bstrdescription: 549691513 == #x20c3a079
    			ole::dwhelpcontext: 541290722 == #x204370e2
    			ole::pvreserved: 536873349 == #x20000985
    			ole::pfndefferedfillin: 548986235 == #x20b8dd7b
    			ole::scode: 549691529 == #x20c3a089
			Error: ole returned an error #x80020003 (code:
#x3, facilty: #x2)

The OLE interface is pretty cool.  It would be great if there were

	:yep

P.S. If comp.lang.lisp.franz is now the de facto ACL newsgroup, maybe
this should be discussed there instead of comp.lang.lisp.

	:There's no traffic there.
From: Kucera, Rich
Subject: stuck: acl ole problem
Date: 
Message-ID: <80C621FFC2DFD2119FFF00805FA7C54F03021014@exchange1.hhmi.org>
>>>oops,  it just worked,  changed :EvalScript to "EvalScript",  

    (ole:auto-method perltool "EvalScript" "$greeting='hello world!';")
    
    (format t "... and then PerlCOM said: ~A"
	    (ole:auto-getf perltool :greeting))

>>>check out the session...so,  I've got a perl engine available within
listener,  
>>>what to do?   Load DBI or LWP and go surfing looks like...

> 
; Loading D:\acl50lite\ole\samples\activePerl\perl.cl


> (test)


Starting OLE PerlCOM test.


"something there" ... and then PerlCOM said: hello world!

The PerlCOM test is complete.


> 

-----Original Message-----
From: Kucera, Rich 
Posted At: Wednesday, June 30, 1999 3:59 PM
Posted To: lisp
Conversation: stuck: acl ole problem
Subject: stuck: acl ole problem


Thanks for response!  See more below

-----Original Message-----
From: ·······@gargoyle.cs.uchicago.edu
[··············@gargoyle.cs.uchicago.edu]On Behalf Of
·······@cs.uchicago.edu (John Wiseman)
Posted At: Wednesday, June 30, 1999 2:39 PM
Posted To: lisp
Conversation: stuck: acl ole problem
Subject: Re: stuck: acl ole problem


"Kucera, Rich" <·······@hhmi.org> writes:

> Group, Been trying to get ACL5 to talk to ActiveState PerlCOM, I
> seem to be able to get a handle on the object and then release it,
> but haven't been able to do more than that.  Anyone know any OLE who
> might know the problem?

I've spent a couple hours using the OLE stuff (so I barely know what
I'm doing), but I don't see anything obviously wrong with your code.

Is it possible that you're not calling EvalScript the right way, or
that EvalScript doesn't exist as a method?  The error you're getting
is named DISP_E_MEMBERNOTFOUND, which makes me suspect that EvalScript
might not exist.

	:It shows up in VBA for windows object browser.  PerlCOM works
ok
	:from there

If there is an EvalScript method, is it possible that the error is
occurring inside the method?  Maybe it's trying to tell you that an
error occurred during evaluation.  You could try something simpler and
see if that works.

	:No that's legal Perl.   In fact all I'm trying to do is an
	:assignment statement.   But I'm not clear on how to pass the
	:string over that contains the script,  either.  It's not a	
	:property,  it's a "&rest" argument.

Is it possible that this PerlCOM thing is an out-of-process server?
This seems unlikely, since you appear to successfully get something
back from ole:ask-for-autotool.

	:No,  in process.  How can I look at "perltool", the thing
returned
	:from ole::ask-for-autotool?  It's not null.  Er...debugger says
	:this about it-
((method auto-method (remote-autotool t)) #<remote-autotool> evalscript
$greeting='hello world!';)

	:Inspector on remote autotool gives me what appears to be a
valid
	:object with type, dispatch and op-map properties...whatever
that means-

'ole:remote-autotool
#<ole::idispatch-client:7567640>
(("EVALSCRIPT" 6))

	:that's all for now...wonder why it's upcase there?  think this
would break it?

Finally, the only difference betwen your code and mine is that I call
ole:ask-for-autotool with a ProgID string (like "MDDatalink.ExtFace")
instead of a class ID thing.  I don't think this should make any
difference, but if you can't find anything else wrong it might be
worth trying to both ways.

	:OK,  tried it.  Different error codes, looks like...how
	:do I find out what these mean anyway?
		excepinfo is
		Foreign object of type ole:excepinfo and allocation :c

		    	struct:
			ole::wcode: 2437 == #x985
    			ole::wreserved: 8192 == #x2000
    			ole::bstrsource: 541292850 == #x20437932
    			ole::bstrdescription: 549691513 == #x20c3a079
    			ole::dwhelpcontext: 541290722 == #x204370e2
    			ole::pvreserved: 536873349 == #x20000985
    			ole::pfndefferedfillin: 548986235 == #x20b8dd7b
    			ole::scode: 549691529 == #x20c3a089
			Error: ole returned an error #x80020003 (code:
#x3, facilty: #x2)

The OLE interface is pretty cool.  It would be great if there were

	:yep

P.S. If comp.lang.lisp.franz is now the de facto ACL newsgroup, maybe
this should be discussed there instead of comp.lang.lisp.

	:There's no traffic there.
From: Johannes Beck
Subject: Re: stuck: acl ole problem
Date: 
Message-ID: <377B3433.F5C4E4FF@informatik.uni-wuerzburg.de>
Hello

> >>>oops,  it just worked,  changed :EvalScript to "EvalScript",
> 
>     (ole:auto-method perltool "EvalScript" "$greeting='hello world!';")
> 
>     (format t "... and then PerlCOM said: ~A"
>             (ole:auto-getf perltool :greeting))
> 
> >>>check out the session...so,  I've got a perl engine available within
> listener,
> >>>what to do?   Load DBI or LWP and go surfing looks like...

Is Perl case-senstive ? (I dont know anything about Perl) 
I've never had any problems with keywords for methods or properties, but
I'm only using VB.

>         :OK,  tried it.  Different error codes, looks like...how
>         :do I find out what these mean anyway?
>                 excepinfo is
>                 Foreign object of type ole:excepinfo and allocation :c
> 
>                         struct:
>                         ole::wcode: 2437 == #x985
>                         ole::wreserved: 8192 == #x2000
>                         ole::bstrsource: 541292850 == #x20437932
>                         ole::bstrdescription: 549691513 == #x20c3a079
>                         ole::dwhelpcontext: 541290722 == #x204370e2
>                         ole::pvreserved: 536873349 == #x20000985
>                         ole::pfndefferedfillin: 548986235 == #x20b8dd7b
>                         ole::scode: 549691529 == #x20c3a089
>                         Error: ole returned an error #x80020003 (code:
> #x3, facilty: #x2)
I had the same problem. There's not much you can do with the excepinfo -
but this is what I've come up to. Maybe it helps

Joe

--
(defun print-excepinfo (excepinfo)
 (when excepinfo 
      (format *debug-io* "BSTRSOURCE=~a~%BSTRDESC=~a~%"
        ;;; this may fail - I dont know when
        (ignore-errors
         (ole:bstr-string
          (ff:fslot-value-typed 'ole:excepinfo nil excepinfo
'ole::bstrsource))
        )
        ;;; this may fail - I dont know when
        (ignore-errors
         (ole:bstr-string
          (ff:fslot-value-typed 'ole:excepinfo nil excepinfo
'ole::bstrdescription)))
        )))

(defmacro with-ole-error-handler (&body body)
  `(handler-case
       (progn  
         ,@body)
     ;;; catch the error
     (ole:incoming-error (c)
                         (let ((hcode (ole:hresult c)))
                           (format *debug-io* "~&OLE-Error: #~X~&
~{~a~&~}"
                             (if (>= ole:disp_e_exception hcode)
                                (- ole:disp_e_exception hcode)
                                hcode )
                             ;;; this may be helpful
                             (rest (simple-condition-format-arguments
c))
                             ))
                         nil)
     ;;; this more a kind of joke - handle segementation faults
     (excl:synchronous-operating-system-signal (c)
                (format *debug-io* 
                    (concatenate 'string "~&Oops! " 
	          (simple-condition-format-control c))
                  (simple-condition-format-arguments c))
                nil) 
     ))


--
Johannes Beck   ····@informatik.uni-wuerzburg.de
                http://www-info6.informatik.uni-wuerzburg.de/~beck/
                Tel.: +49 931 312198
		Fax.: +49 931 7056120
                
PGP Public Key available by ·············@informatik.uni-wuerzburg.de
From: John Wiseman
Subject: Re: stuck: acl ole problem
Date: 
Message-ID: <arxhfnotj8f.fsf@gargoyle.cs.uchicago.edu>
Glad you got it to work.


> 	:OK,  tried it.  Different error codes, looks like...how
> 	:do I find out what these mean anyway?
> 		excepinfo is
> 		Foreign object of type ole:excepinfo and allocation :c
> 
> 		    	struct:
> 			ole::wcode: 2437 == #x985
>     			ole::wreserved: 8192 == #x2000
>     			ole::bstrsource: 541292850 == #x20437932
>     			ole::bstrdescription: 549691513 == #x20c3a079
>     			ole::dwhelpcontext: 541290722 == #x204370e2
>     			ole::pvreserved: 536873349 == #x20000985
>     			ole::pfndefferedfillin: 548986235 == #x20b8dd7b
>     			ole::scode: 549691529 == #x20c3a089
> 			Error: ole returned an error #x80020003 (code:
> #x3, facilty: #x2)

I have Visual C++ installed, so I searched for *.h files containing
"80020003".  It was in winerror.h.  The code that was just posted that
(I think) extracts the description string would probably be helpful
too.


John