Help with dwt-cocoa types
Jacob Carlborg
doobnet at gmail.com
Tue Jul 8 13:51:19 PDT 2008
I'm porting swt-cocoa to D and I've run into some type problems that I'm
not sure how to best solve.
There are many types that Java don't support like pointers for example
and so they replace them with int. I'm now trying to replace them back
to, as closely match to, the original types. I'm thinking like this:
when the int represents a struct, enum, typedef or other C type I just
keep that C type in D. But when the int represents an objective-c (objc)
class there are some problems. All objc classes inherit (or based on)
from a C type called "id" that looks like this:
typedef id (*IMP)(id, SEL, ...);
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html
If the int represents an objc class that is a value type I replace that
with the type "id" in D.
If the int represents pointer to an objc class I replace that with a
class in D (because it's a class in Java)
If the int represents a pointer to pointer to a objc class I replace
that with the type "id**" in D.
But at some places
(http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/Reference/Reference.html#//apple_ref/occ/clm/NSData/data)
when they use type type "id" in objc they use in Java a class called
"id" (which contains an int), but at other places they use an int for
that in Java. That I don't understand.
So what do you think about all this?
More information about the Digitalmars-d-dwt
mailing list