On Nov 29, 2008, at 3:42 AM, Anton Ertl wrote:
Dennis Ruffer wrote:
Here's yet another puzzle for the interface semantics:
err = (*iodev)->QueryInterface(iodev, CFUUIDGetUUIDBytes
(kIOUSBDeviceInterfaceID), (LPVOID)&dev);
Does this have anything to do with the function pointers described in
the docs, or is this something else entirely?
Yes, this looks like a call through a function pointer.
Thanks for the answers Jack and Anton, here's what I've got so far:
err = (*dev)->Release(dev);
becomes:
\c typedef long (* func1)(void*);
\c #define call_func1(par1,fptr) ((func1)fptr)(par1)
c-function call_func1 call_func1 a func -- n
begin-structure IUNKNOWN_C_GUTS
field: reserved
field: QueryInterface \ a a a -- n
field: AddRef \ a -- n
field: Release \ a -- n
end-structure
dev @ dup @ Release @ call_func1 .
However, with QueryInterface, I need to figure out what
CFUUIDGetUUIDBytes is doing
It is defined as:
typedef struct {
UInt8 byte0;
UInt8 byte1;
UInt8 byte2;
UInt8 byte3;
UInt8 byte4;
UInt8 byte5;
UInt8 byte6;
UInt8 byte7;
UInt8 byte8;
UInt8 byte9;
UInt8 byte10;
UInt8 byte11;
UInt8 byte12;
UInt8 byte13;
UInt8 byte14;
UInt8 byte15;
} CFUUIDBytes;
/* The CFUUIDBytes struct is a 128-bit struct that contains the
raw UUID. A CFUUIDRef can provide such a struct from the
CFUUIDGetUUIDBytes() function. This struct is suitable for
passing to APIs that expect a raw UUID.
*/
CFUUIDBytes CFUUIDGetUUIDBytes(CFUUIDRef uuid);
However, I can't figure out any thing to put in the return value to
prevent errors.
c-function CFUUIDGetUUIDBytes CFUUIDGetUUIDBytes a -- a
gives me:
/Users/druffer/.gforth/libcc-tmp/gforth_c_103DF4C.c:11: error:
aggregate value used where an integer was expected
What is an aggregate return value?
DaR
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]