Re: [Pyobjc-dev] Can't bridge UCConvertUTCDateTimeToCFAbsoluteTime
Brought to you by:
ronaldoussoren
|
From: Ronald O. <ron...@ma...> - 2007-11-27 06:02:42
|
On 26 Nov, 2007, at 21:17, blake wrote:
>> I am trying to bridge UCConvertUTCDateTimeToCFAbsoluteTime using
>> PyObjC in Leopard.
>>
>> The problem that I am running into is that
>> UCConvertUTCDateTimeToCFAbsoluteTime takes a struct that's declared
>> (on 32 bits) as {unsigned short; unsigned long; unsigned short;}
>> using
>> packed alignment, which means that the offset of the 4-byte long
>> member is 2. When I use {UTCDateTime=SLS}, PyObjC puts the 4-byte
>> long
>> at offset 4, which then causes problems down the line.
>>
>> Looking at PyObjC source, I don't see a way to force custom alignment
>> of struct members.
>>
>> Did I miss some mechanism for handling this? What are my option?
>> Thanks,
>>
>> Ben
>
> The problem appears to be that no metadata exists for <CarbonCore/
> UTCUtils.h>. You might try running gen_bridge_metadata(1) on
> CarbonCore.framework, or typecast UTCDateTime to int64_t instead.
Generating metadata won't help. AFAIK metadata doesn't have support
for packed structs, and PyObjC definitely doesn't even if the metadata
would.
Casting int64_t should help, but isn't easily possible from Python.
This could easily be done using metadata though (that is, teach
gen_bridge_metadata that it should treat a UTCDateTime struct as if it
is an int64_t) and then generate the required metadata.
Ronald
>
> Blake Chaffin
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
> Pyobjc-dev mailing list
> Pyo...@li...
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
|