On 03.04.2009, at 09:22, Ryan Joseph wrote:
The Pascal compiler I'm using would need some extra runtime support (like telling me if a pointer is an object) to accomplish what you are talking about, but yes that is the way it should work. I think the Ruby and Python bridges made changes to the actual compiler also that I'm not able to do so I need to look into other more creative solutions.
Maybe I'm misunderstanding you, but can't you instead just do a compile-time switch on the pointer's type? If someone declares an ObjC pointer type (or CF pointer type) as a parameter type, you can tell *at compile time* that passing a regular array will need to be converted to that type. So you insert the conversion code. That is where you should IMHO be trying to solve that problem.
Alternatively, I'm not too familiar with the Object Pascal runtime, but aren't there classes used for the built-in types that you could possibly redefine? Either just make them thin wrappers around CFArrays etc., or create several subclasses (a class cluster if you wish) that are regular Pascal arrays and CFArrays, and have functions to convert from one to the other.
Then you could generate a stub library using the BridgeSupport files that automatically wraps CFTypes in appropriate Pascal objects. Of course, that still wouldn't solve the issues of directly manipulating structs that contain CFTypes, but I presume those would need to be handled specially anyway.
But finally, keep in mind that even Objective C makes no effort to bridge the plain C types to CFTypes. So I think it would be perfectly OK to just not do that wrapping, but rather provide conversion functions for those cases where you need it, and let people deal directly with the CFTypes (Maybe aided by simple helper classes they can add to their projects).
Cheers, -- Uli Kusterer "The Witnesses of TeachText are everywhere..." http://www.zathras.de _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com