Re: [comtypes-users] ITypeLib::ReleaseTLibAttr definition wrong in comtypes

2009-03-14 Thread Michael Eddington
Correct me if I'm wrong, but I think you just defined it to return a
"void*" (c_voidp).  I think you just want to set the return type to
None for a void.

mike


On Sat, Mar 14, 2009 at 3:14 AM, Michael Curran
 wrote:
> Hi,
>
> I have noticed that the definition of ITypeLib::ReleaseTLibAttr seems to
> be wrong in typeinfo.py, in comtypes.
>
> In XP and Vista it works ok oddly enough, but in particular builds of
> Windows 7 it does not.
>
> In fact, in these builds, many times when it is called, it throws an
> _ctypes.COMError, with an error code of -65535.
>
> I think the reason for this is that it is defined in comtypes as
> returning an hresult, but it really returns void.
>
> Its definition in comtypes looks like this:
>     COMMETHOD([], HRESULT, 'ReleaseTLibAttr',
>               (['in'], POINTER(TLIBATTR)))
> ]
>
> But in OAIdl.idl, it looks like this:
>     void ReleaseTLibAttr(
>                 [in]  TLIBATTR * pTLibAttr
>             );
>
> So I think the comtypes definition should be:
>     COMMETHOD([], c_voidp, 'ReleaseTLibAttr',
>               (['in'], POINTER(TLIBATTR)))
> ]
>
> I have tested this change on the particular builds of Windows7 the
> problem occured on and it definitly fixes it.
> It also does not seem to cause any problems on Vista, but I havn't been
> testing for long.
>
> Thanks
> Mick
>
>
> --
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> ___
> comtypes-users mailing list
> comtypes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/comtypes-users
>

--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users


Re: [comtypes-users] ITypeLib::ReleaseTLibAttr definition wrong in comtypes

2009-03-14 Thread Michael Curran
Perhaps you can use None, I'm not sure. However, I used c_voidp, not 
c_void_p.
c_voidp as far as I am aware means void parameter, not void pointer. 
c_voidp can be used in ctypes function declarations for the return type 
when it is void.

c_void_p is void pointer.

Mick


On 15/03/2009 5:38 AM, Michael Eddington wrote:
> Correct me if I'm wrong, but I think you just defined it to return a
> "void*" (c_voidp).  I think you just want to set the return type to
> None for a void.
>
> mike
>
>
> On Sat, Mar 14, 2009 at 3:14 AM, Michael Curran
>   wrote:
>
>> Hi,
>>
>> I have noticed that the definition of ITypeLib::ReleaseTLibAttr seems to
>> be wrong in typeinfo.py, in comtypes.
>>
>> In XP and Vista it works ok oddly enough, but in particular builds of
>> Windows 7 it does not.
>>
>> In fact, in these builds, many times when it is called, it throws an
>> _ctypes.COMError, with an error code of -65535.
>>
>> I think the reason for this is that it is defined in comtypes as
>> returning an hresult, but it really returns void.
>>
>> Its definition in comtypes looks like this:
>>  COMMETHOD([], HRESULT, 'ReleaseTLibAttr',
>>(['in'], POINTER(TLIBATTR)))
>> ]
>>
>> But in OAIdl.idl, it looks like this:
>>  void ReleaseTLibAttr(
>>  [in]  TLIBATTR * pTLibAttr
>>  );
>>
>> So I think the comtypes definition should be:
>>  COMMETHOD([], c_voidp, 'ReleaseTLibAttr',
>>(['in'], POINTER(TLIBATTR)))
>> ]
>>
>> I have tested this change on the particular builds of Windows7 the
>> problem occured on and it definitly fixes it.
>> It also does not seem to cause any problems on Vista, but I havn't been
>> testing for long.
>>
>> Thanks
>> Mick
>>
>>
>> --
>> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
>> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
>> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
>> software that enables intelligent coding and step-through debugging.
>> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
>> ___
>> comtypes-users mailing list
>> comtypes-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/comtypes-users
>>
>>  
> --
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> ___
> comtypes-users mailing list
> comtypes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/comtypes-users
>

--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users


Re: [comtypes-users] ITypeLib::ReleaseTLibAttr definition wrong in comtypes

2009-03-16 Thread Thomas Heller
Michael Curran schrieb:
> Perhaps you can use None, I'm not sure. However, I used c_voidp, not 
> c_void_p.
> c_voidp as far as I am aware means void parameter, not void pointer. 
> c_voidp can be used in ctypes function declarations for the return type 
> when it is void.
> 
> c_void_p is void pointer.

c_voidp and c_void_p is actually the very same type; which means a void pointer.
If a function or method returns nothing, 'void func(...)' in C, than 'None'
should be used for the .restype attribute.

So the correct comtypes definition is:
>>>  COMMETHOD([], None, 'ReleaseTLibAttr',
>>>(['in'], POINTER(TLIBATTR)))
>>> ]


Thanks for finding it. I will correct it in svn asap.

Thomas


--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users


Re: [comtypes-users] ITypeLib::ReleaseTLibAttr definition wrong in comtypes

2009-03-17 Thread Thomas Heller
Thomas Heller schrieb:
> Michael Curran schrieb:
>> Perhaps you can use None, I'm not sure. However, I used c_voidp, not 
>> c_void_p.
>> c_voidp as far as I am aware means void parameter, not void pointer. 
>> c_voidp can be used in ctypes function declarations for the return type 
>> when it is void.
>> 
>> c_void_p is void pointer.
> 
> c_voidp and c_void_p is actually the very same type; which means a void 
> pointer.
> If a function or method returns nothing, 'void func(...)' in C, than 'None'
> should be used for the .restype attribute.
> 
> So the correct comtypes definition is:
  COMMETHOD([], None, 'ReleaseTLibAttr',
(['in'], POINTER(TLIBATTR)))
 ]
> 
> 
> Thanks for finding it. I will correct it in svn asap.

This is now fixed in SVN.  If anyone needs a new release please let me know.
Changes since 0.6 so far are only these:

2009-03-17  Thomas Heller  

* Fixed the return type of ITypeLib::ReleaseTLibAttr, which is
documented wrongly in MSDN.  The return type is void, not HRESULT.
Reported to cause crashes on Windows 7.

2009-01-29  Thomas Heller  

* Restore compatibility with Python 2.3.

* comtypes\client\_code_cache.py: Add missing 'import types' in
comtypes\client\_code_cache.py.



-- 
Thanks,
Thomas


--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
___
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users