On 3 Mar 2014, at 19:23, Kyle Sluder <k...@ksluder.com> wrote:

> But Jonathan, why are you even exposing raw C pointer access to the
> identifiers in the first place? Why wouldn't you convert them to
> NSStrings and only expose them to Objective-C code that way?
> 
Jens sort of nailed it.
The underlying Mono API is C.

So every call to a managed method looks something like:
onoObject *monoObject = [self invokeMonoMethod:"SumAndSwitch(double*,double*)" 
withNumArgs:2, p1, p2];

The code generator wraps it up like so:

- (float)sumAndSwitch_withFloatPtrX:(float*)p1 floatPtrY:(float*)p2
{
    MonoObject *monoObject = [self 
invokeMonoMethod:"SumAndSwitch(single*,single*)" withNumArgs:2, p1, p2];
    return DB_UNBOX_FLOAT(monoObject);
}

So only the direct access Cocoa methods have to futz with char *.

There would be an obvious overhead unboxing every NSString instance.
Plus I would have to refactor the entire legacy API.

I don’t really like all the char * pointers but given the context of the API 
it’s probably for the best.

Jonathan 


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to