Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JNI types and usage newbie



here is what I mean:


on native side you have NSString * so you send it to java side as int:
NSString *nsstr;
int arg = (int)nsstr;
env->Call<Some>Method(mid,....,arg,...)

Java side

NSString jnsstr = sommemethod(arg)

so I'm asking about <somemethod> implementation.



On Apr 30, 2004, at 6:09 AM, Michael Hall wrote:


On Thursday, April 29, 2004, at 11:18 PM, Dmitry Markman wrote:

it would be nice to have some way to create CocoaJava NSwhatever
from Cocoa NSwhatever* in that case someone could send to Java CocoaJava object


I'm not sure I'm exactly following here.
If you are saying writing ObjectiveC to message a created java object I don't know if this is possible or not. I think maybe this is sort of what the Cocoa Java bridge was supposed to provide? But I'm not familiar enough with that to say it is or isn't and maybe something is impossible here.
For the rest I am going to speak more to the JNIDirect Cocoa interface code or Synthetic Cocoa for the catchy name I came up with for it that I have been working on rather than to Cocoa Java which I am less familiar with at this point as to what you can and can't possibly do.
If you mean that when you are looking at an ObjectiveC program where it indicates an NString * is there some way to translate that into a java object that you can send the normal NSString messages. Yes, Patrick Beard had aJNIDirect NSString example for this going back at least a year. I have added quite a few new, java representations of Cocoa classes, the last few weeks myself besides NSString based on this example.
If you mean can you create a brand new java class that subclasses NSObject or NSResponder that you can create new instances of, or that you can give selector methods that Cocoa will do callback's on just as if it were a Cocoa object of a given class yes that is the synthetic part of the catchy name I came up with.
If you mean something else please clarify and I will try to determine if it is or isn't impossible in what the JNIDirect Cocoa interface can do.
It is of course very incomplete. I still have no good understanding of what nib's do. Or how NSViews map to java windows so that I can't even draw a simple red rectangle on a java window so far. Although eventually I mean to try it. Having someone more familiar with how the plumbing works here would be nice but otherwise I'll keep muddling through on the stuff trying to make JNIDirect a somewhat interesting alternative to JNI or the Cocoa Java bridge for some of what you might want to do. I intend it to be my preferred alternative obviously.

it probably was discussed on that list and
AFAIK that's impossible to do.

If you mean the Cocoa-dev list I'm not still not sure what you mean about what they've discussed and found impossible. They have been discussing CamelBones the last couple of days or so which is I think code took the same approach with using the ObjectiveC Runtime stuff to interface ObjectiveC and Python. I noticed it in some of my searches on the ObectiveC Runtime. Although there were other uses of these methods CamelBones appeared to be the only one I think that seemed to have successfully used the approach to make a interface to another language.
I have meant to acknowledge on that list thread that it was interesting to see someone having had some success with what I am trying but the fact that it took the same approach to the same problem is as far as I know all that it actually has in common with what I am doing.. But if you find CamelBones more credible than me it might interest you to know that mine is pretty much the same approach. Patrick Beard also mentioned the approach in later versions of the JNIDirect White paper so maybe I vaguely remembered the idea from having read that months ago. Anyhow I am trying to actually write it up for java where-ever the idea came from.

Back on the topic of what's impossible I still need a better idea of what you're talking about if I haven't touched on it?

Mike Hall <mikehall at spacestar dot net>
<http://www.spacestar.net/users/mikehall>


Dmitry Markman
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: JNI types and usage newbie (From: Michael Hall <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.