Lisp HUG Maillist Archive

Re: COM. Questions and Bugs

Some progress has been made.

I now have a question.

How are enums treated in the COM interface?

COM:MIDL gives out messages like

;;;   Enum Constant SCRIPTSTATE_UNINITIALIZED as 
SCRIPTSTATE_UNINITIALIZED

However, how can I use that symbol in a DEFINE-COM-METHOD?  Doing a 
FIND-SYMBOL on "SCRIPTSTATE_UNINITIALIZED" followed by a (DESCRIBE *) 
seems to indicate that the symbol has been created, but that there is 
no value associated to it.

Cheers

--
Marco Antoniotti
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.

--
Marco Antoniotti
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.


Re: COM. Questions and Bugs

Unable to parse email body. Email id is 918

Re: COM. Questions and Bugs

On Tuesday, Mar 4, 2003, at 03:58 America/New_York, Nick Levine wrote:

> Morning all.
>
>    How are enums treated in the COM interface?
>
>    COM:MIDL gives out messages like
>
>    ;;;   Enum Constant SCRIPTSTATE_UNINITIALIZED as
>    SCRIPTSTATE_UNINITIALIZED
>
> I don't use com:midl, everything I need is a type library and I use
> defsystem to compile & load it. So your mileage might differ.
>
> Enum constants map to defconstant. This can lead to entertaining
> clashes down the line. StdOle2 contains:
>
>    typedef [uuid(E6C8FA08-BD9F-11D0-985E-00C04FC29993)]
>    enum {
>        Default = 0,
>        Monochrome = 1,
>        VgaColor = 2,
>        Color = 4
>    } LoadPictureConstants;
>
> which results in a (defconstant color). But the type library I'm using
> contains a number of places where color is used as a parameter, for
> example:
>
>        HRESULT isTransparent(
>                        [in] long color,
>                        [out, retval] VARIANT_BOOL* pIsTransparent);
>
> The outcome: "Error trying to rebind a constant." How we laughed. Sigh,
> you probably get away with it in the C world because the reader is
> case sensitive. I unintern COLOR (and DEFAULT, which too has started
> giving me unwarranted hassle recently) from *package* and carry
> on. The following:
>
>     (dolist (symbol '(color default))
>       (let ((value (symbol-value symbol)))
> 	(makunbound symbol)
> 	(setf (symbol-value symbol) value)))
>

Ok.  Thanks for the warning.

> works well enough.
>
>    However, how can I use that symbol in a DEFINE-COM-METHOD?  Doing a
>    FIND-SYMBOL on "SCRIPTSTATE_UNINITIALIZED" followed by a (DESCRIBE
>    *) seems to indicate that the symbol has been created, but that
>    there is no value associated to it.
>
> I'll pass on that.
>

Any other taker?

This is now the show stopper for me.  And it is not just a show stopper 
for me or Lispworks.  It is a show stopper for Common Lisp in my lab 
(don't ask why).

Cheers


--
Marco Antoniotti
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.


Re: COM. Questions and Bugs

On Tuesday, Mar 4, 2003, at 10:08 America/New_York, Marco Antoniotti 
wrote:

>
> On Tuesday, Mar 4, 2003, at 03:58 America/New_York, Nick Levine wrote:
>
>> Morning all.
>>
>>    How are enums treated in the COM interface?
>>
>>    COM:MIDL gives out messages like
>>
>>    ;;;   Enum Constant SCRIPTSTATE_UNINITIALIZED as
>>    SCRIPTSTATE_UNINITIALIZED
>>
>>
>>    However, how can I use that symbol in a DEFINE-COM-METHOD?  Doing a
>>    FIND-SYMBOL on "SCRIPTSTATE_UNINITIALIZED" followed by a (DESCRIBE
>>    *) seems to indicate that the symbol has been created, but that
>>    there is no value associated to it.
>>
>> I'll pass on that.
>>
>
> Any other taker?
>
> This is now the show stopper for me.  And it is not just a show 
> stopper for me or Lispworks.  It is a show stopper for Common Lisp in 
> my lab (don't ask why).
>
>

So, shall I conclude that you cannot use enum constants in the 
COM/AUTOMATION interface?

Shall I pack my Common Lisp and throw it out of the window?

Cheers

--
Marco Antoniotti
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.


Updated at: 2020-12-10 09:00 UTC